I'm able to upload a file to bitbucket repository but there is any way to upload a folder using CURL and API.
Asked
Active
Viewed 1,440 times
1 Answers
1
The API is thinly documented, but this is what works for me:
Using cURL:
curl --user <username:password> -X POST https://api.bitbucket.org/2.0/repositories/<workspace_name>/<repository_name>/src -F <local_file_name.ext>=@<destination_filename.ext>
For a username of "Foo" and password of "Bar", in my workspace called "widgetcentral", a repository named "testRepo", local filename of "sampleFile.txt" I would do
curl --user Foo:Bar -X POST https://api.bitbucket.org/2.0/repositories/widgetcentral/testRepo/src -F sampleFile.txt=@sampleFile.txt
One caveat, this seems to upload only to master, I can't get it to upload to any branch.

Core PCN
- 21
- 2
-
1Can this be used to upload an entire directory? – MantyQuestions Feb 01 '23 at 05:05