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.
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 https://api.bitbucket.org/2.0/repositories/<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
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.