0

I have a commit ID. I want to download the file from Bitbucket using commitID through REST API

curl --user myuser@mydomain.com:password "https://api.bitbucket.org/2.0/repositories/MyCompany/myrepo/src/master/path/to/file.txt"

This looks like it downloads the latest file from the bitbucket. Can we download the source code for the particular commit ?

user3603360
  • 123
  • 1
  • 3
  • 10

2 Answers2

1

To browse the file from a particular commit you have provide the COMMIT_ID in the query parameter like this :

https://<BITBUCKET_URL>/projects/<PROJECT_GROUP>/repos/<REPO_NAME>/browse?at=<COMMIT_ID>

In your case the curl will look something like this :

curl --user myuser@mydomain.com:password "https://api.bitbucket.org/2.0/repositories/MyCompany/myrepo/src/master/path/to/file.txt?at=commit_hash"

Abhishek
  • 1,558
  • 16
  • 28
0

To download the files from a particular commit id :

https://bitbucket.org/projectName/repo-name/get/[commitid].zip

Avinash Gupta
  • 208
  • 5
  • 18