I'm looking for a way to download a file from bitbucket, (not the repository, a file from the download section). Currently, it is possible to clone a repository using a deployment key, but I couldn't make it work for downloads.
I have tried the following:
curl -u username: --key .ssh/id_rsa --pubkey .ssh/id_rsa.pub scp://bitbucket.org/repositoryowner/downloads/downloadfile.zip
EDIT:
The current best workaround is to create a throw-away dummy user:
wget -O /tmp/file --user "username" --password "password" https://bitbucket.org/owner/rep/downloads/abc.tar.gz
After a bunch of failed attempts, I received this response from Bitbucket support:
Access keys in Bitbucket Cloud can be used for cloning or pulling from a repository only, I'm afraid it is not possible to download files from the Downloads section of the repo with SSH keys.
Unless the repository is public, users will need to have a Bitbucket Cloud account in order to authenticate and download files from the Downloads page.
Feel free to let us know if you have any further questions.
This has now been made a feature request on Bitbucket. If you want to have this functionality, then upvote it:
https://bitbucket.org/site/master/issues/18501
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With