Does this concern a Bitbucket Cloud repo (hosted on https://bitbucket.org/) or a Bitbucket Server one (self-hosted instance)?
The two products have different API.
In Bitbucket Cloud this is possible, you can do this using the following endpoint:
An example call would be
curl -X POST -u username:password https://api.bitbucket.org/2.0/repositories/repo-owner/repo-slug/src -F message="test commit message" -F branch=feature_branch -F folder1/my_file.txt=@/Users/tboudale/uploaded_file.txt
username is the username of the Bitbucket account you are authenticating with
password the password of this account or an app-password
repo-owner is the workspace ID of the workspace this repo belongs to
repo-slug is the repository slug
This command uploads the file /Users/tboudale/uploaded_file.txt from my machine, to branch feature_branch.
This file is placed in the folder named folder1 in that branch and the file in the repo is named my_file.txt (if the folder doesn't exist already, it will get created as well).
If you don't want to place the file in a certain folder, simply omit the part folder1/ and use only the name you'd like this file to have in the repo.
I'm not sure if there is an API endpoint to do the same for Bitbucket Server. Please feel free to let me know if this concerns a Bitbucket Server repo, and I'll reach out to someone from Bitbucket Server support team to assist.
Hi @Sneha Badera ,
Thank you for your reply.
This is possible via API for Bitbucket Server too with the following endpoint and PUT method:
The documentation also includes an example curl call.
Please feel free to let me know if you need anything further.
Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster ! While we’re all excited about the new improvements to Bitbucket ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events