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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

2,045 views 1 5
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