Fetching file with curl with 2 factor authorization enabled Edited

I am trying to fetch a file from a private repository, a shell script. And I'd like to run it immediately.

I tried with 

curl --user username:pass https://repo_path/file.sh | sh

But I don't get anything. I even tried putting app password, again, nothing.

I tried with 

curl https://user:password@bitbucket.org/repo_path/file.sh | sh

No luck.

 

Any ideas how should I do this?

 

I'm doing this so that the new users can just paste this line in their terminal, and the script will set the project up for them (clone the repo among other things).

1 answer

1 accepted

0 votes
Accepted answer

Ok, I managed to do it, by doing a request to the Bitbucket API, with the correct endpoint and app password.

 

curl -u username https://api.bitbucket.org/1.0/repositories/user_repo_name/repo_name/raw/master/file.sh | sh

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

449 views 6 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you