Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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

How can i upload one file to repo by API?

I have set up automatic deployment in my repositories to deploy my PHP / Laravel applications.

Now I need to know how I can upload one * .yml file to my BitBucket repository and to a specific branch.

How can I do this? I am looking for an API that I can send via curl but cannot find a working solution.

1 answer

0 votes
Patrik S Atlassian Team Jun 30, 2022

Hello @Paweł Grzyb ,

Welcome to Atlassian Community!

My understanding is that you would like to commit a file to your repository for a given branch by using the Bitbucket API. If that is the case, you can use the Create a commit by uploading a file endpoint , as per the example below : 

curl  --user USERNAME:APP_PASSWORD<workspace>/<repository>/src \
  -F /path/within_repo/my_test_file.txt=@local_file_to_be_commited.txt \
  -F "message=This is the commit message" \
  -F "author=Name <e-mail address>" \
  -F "branch=my_branch" 

For the authentication, you will need to provide your bitbucket username (not e-mail address) which you can find under your account's personal settings, along with an App Password (not the account password).

Also, the command above considers the file you are trying to upload (local_file_to_be_commited.txt) is in the same directory where you are executing the curl command.

You can try the above suggestion and let us know how it goes.

Thank you, @Paweł Grzyb .

Kind regards,

Patrik S

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events