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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,500 views 26 12
Join discussion

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