Rest api to make commit and push to a bitbucket repository

Hi,

I have a use case where I need to make changes to a bitbucket repository. Like, make some changes in file present in that repository through rest api.

We can’t clone the repository and then make changes in it. As this is being implemented in a Spring boot server.

Is there any way to achieve this?

Hi @AbhijeetKumar,
Welcome to the Atlassian Developer Community.

Bitbucket Cloud (available at bitbucket.org) provides a POST /2.0/repositories/{workspace}/{repo_slug}/src REST API endpoint which can be used to create new commits in the repository by uploading files.

You can find the relevant documentation and some examples here.

I see that you mention that the repository can’t be cloned, however I’m wondering why that’s the case and if it wouldn’t be possible to change that so that the standard git commands can be used for updating the repository. Feel free to share a bit more about the use case as well.

Cheers,
Caterina

1 Like

Hi @ccurti , Thanks, I was able to find this api and was able to use it.

In my use case, we are going to make changes in a file in a repo inside a Kubernetes operator. I think that cloning repo inside that will cause memory issue.