Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Curl file from Downloads page?

Amos Anderson June 2, 2014

I have a few files on the downloads page on my bitbucket repository. Is there a way I can download these files from the command line using the SSH key I've stored with my account? Or what's the easiest way to do it?

2 answers

1 accepted

3 votes
Answer accepted
Amos Anderson June 3, 2014

I figured out my own answer. I'm not sure why it wasn't working when I was trying before... Part of the problem was that at some point the file became corrupted (i.e., I couldn't even download it from a browser).

curl --user username -L -O  https://bitbucket.org/account/repo/downloads/myfile.tar.gz

mark.bokil October 19, 2019

Is there a curl POST command I can use to push an artifact to my downloads folder?

Sahil S Shetye
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 18, 2019
Like mark.bokil likes this
1 vote
tlroche
Contributor
June 2, 2014

@Amos Anderson: "Is there a way I can download these files from the command line using the SSH key"

In my experience, you don't even need the SSH key.

"what's the easiest way to do it?"

`curl` should work, but I usually use `wget` just because the latter handles redirection better. E.g. (file < 10 kB, syntax=bash)

URI='https://bitbucket.org/tlroche/lightningnox/downloads/Makefile.2006.06'
DIR='/tmp'              # or wherever you wanna save it
FN="$(basename ${URI})" # or whatever you wanna call it
FP="${DIR}/${FN}"       # full path
wget -c -O ${FP} ${URI}

Amos Anderson June 3, 2014

Hi Tom, thanks for the answer. It's a private repository, so some kind of authentication is needed. Here's what I get:

wget --ask-password --user=username -c https://bitbucket.org/account/repo/downloads/largefile.tar.gz
Password for user ‘username’: 
--2014-06-04 15:48:40--  https://bitbucket.org/account/repo/downloads/largefile.tar.gz
Resolving bitbucket.org (bitbucket.org)... 131.103.20.168, 131.103.20.167
Connecting to bitbucket.org (bitbucket.org)|131.103.20.168|:443... connected.
HTTP request sent, awaiting response... 401 UNAUTHORIZED
Reusing existing connection to bitbucket.org:443.
HTTP request sent, awaiting response... 302 FOUND
Location: https://bitbucket.org/account/repo/downloads/None [following]
--2014-06-04 15:48:41--  https://bitbucket.org/account/repo/downloads/None
Reusing existing connection to bitbucket.org:443.
HTTP request sent, awaiting response... 401 UNAUTHORIZED
Reusing existing connection to bitbucket.org:443.
HTTP request sent, awaiting response... 404 NOT FOUND
2014-06-04 15:48:41 ERROR 404: NOT FOUND.

Jens Rosemeier
Contributor
February 27, 2019

In case you still have problems with the download - as i just had the same issue; i came across a working solution using the API from Bitbucket and an app password.

I have described the details here:

http://www.jens79.de/2019-02-27/download-files-from-bitbucket-team-repositorys-download-section.html

Like 2 people like this

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira product discovery learning path, product discovery training, idea prioritization, align stakeholders, discovery to delivery, product collaboration, atlassian learning, dev process, roadmap planning, insight capture, team alignment

Elevate Your Skills with Jira Product Discovery!

Unlock your potential and learn how to use Jira Product Discovery to your advantage. You’ll have the expertise to revolutionize ideas and insights, roadmapping, engage and align teams and stakeholders, and deliver the best solutions—faster. Enroll today!

Start Learning
AUG Leaders

Atlassian Community Events