0

Ideally I want to do it without using git (with curl command) but if I have to use git is ok.

I could do it for a public repo with:

curl -L "https://bitbucket.org/{username}/{repo}/get/{branch}.zip" > downloaded_file.zip

I tried this way for a private repository, but it didn't work. It's seems that way is not supported anymore.

I also tried with:

curl -L -H "Authorization: Bearer {ACCESS_TOKEN}" https://bitbucket.org/{username}/{repo}/get/master.tar.gz

I replaced {ACCESS_TOKEN} with the key generated by a oauth consumer in bitbucket, then I tried with the secret, but it didn't work in any way. (I didn't check the "This is a private consumer" field when I created this consumer). When I execute this in cmd I get a corrupt zip file.

And I also tried with git clone [repo url].git but it prompts me for credentials and I want to specify the credentials in the script so it can be downloaded automatically.

I'm lost here, any help is welcome.

Community
  • 1
  • 1
Aikanáro
  • 867
  • 3
  • 20
  • 42
  • 1
    Possible duplicate of [Download private BitBucket repository zip file using http authentication](http://stackoverflow.com/questions/17682143/download-private-bitbucket-repository-zip-file-using-http-authentication) – TheGeorgeous Mar 10 '17 at 02:36
  • As indicated in [this comment](http://stackoverflow.com/questions/17682143/download-private-bitbucket-repository-zip-file-using-http-authentication/17778114#comment51997727_17778114) bitbucket has deprecated the solution in the referenced answer. That's why I'm asking this question again – Aikanáro Mar 10 '17 at 12:33

1 Answers1

0

I could do it this way:

curl -L -u {user}:{pass} "https://bitbucket.org/{username}/{repo}/get/{branch}.zip" > downloaded_file.zip
Aikanáro
  • 867
  • 3
  • 20
  • 42