Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Is there a way to commit and push multiple files to a bitbucket branch using rest API's.

I want to commit and push multiple files of my application to a bitbucket branch using rest API's.

1 answer

0 votes

Hi Sneha,

Does this concern a Bitbucket Cloud repo (hosted on 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 -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.

Kind regards,

This is for the Bitbucket Server one (self-hosted instance), basically I have a branch checked out on my local machine and want to commit and push all the changed files to that branch on the server.

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.

Kind regards,

@Theodor Bogdanovic ,

Do we have any sample rest url  for this instead curl.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events