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.