Reputation: 133
I have a commit ID. I want to download the file from Bitbucket using commitID through REST API
curl --user [email protected]: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 ?
Upvotes: 0
Views: 1687
Reputation: 228
To download the files from a particular commit id :
https://bitbucket.org/projectName/repo-name/get/[commitid].zip
Upvotes: 0
Reputation: 1618
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 [email protected]:password "https://api.bitbucket.org/2.0/repositories/MyCompany/myrepo/src/master/path/to/file.txt?at=commit_hash"
Upvotes: 1