Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to block push in BitBucket

Vsevolod Romanchenko February 28, 2023

We have Bitbucket Cloud. My question is how to block the opportunity to "push" but save "create and merge pull requests"?

Groups has the "Write" permission, 

2 answers

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 1, 2023

Hi @Vsevolod Romanchenko and welcome to the community!

If you are an admin of a Bitbucket Cloud repo, you can do the following:

  1. Open the repository on Bitbucket cloud website
  2. Select Repository settings from the left sidebar
  3. Select Branch restrictions from the left sidebar
  4. You can then set up a branch restriction with the following options:

    Screenshot 2023-03-01 at 15.23.19.png


If you set Write access to Only specific people or groups have write access and then leave the field below it empty, no one will be able to push to the branch or branches with this restriction.

In the Select branches option, you need to specify the branch name or pattern for which the restriction will apply.

You can see more details on branch restrictions here:

Please feel free to let me know if you have any questions.

Kind regards,
Theodora

Vsevolod Romanchenko March 1, 2023

I have already do this. The main problem: what if I will have 150 repos, I need to go into each repo settings ? Maybe, in the future BitBucket Cloud will have some automation rules, like in Jira Cloud...

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 3, 2023

Hi @Vsevolod Romanchenko,

Our development team has been working on a feature that will allow admins to set branch permissions on a project (and then these will apply to all repos of a certain project). When this is implemented, we are going to update the public feature request we have in our issue tracker:

You can also add yourself as a watcher to that feature request (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.

In the meantime, until this feature is implemented, another option would be to write a script that uses our APIs in order to set the branch restrictions.

The following API endpoint gets all repos in a workspace:

This API endpoint creates a branch restriction for a repository:

Kind regards,
Theodora

0 votes
Mehmet Berber February 28, 2023

Yolu can arrange that by Branch Permissions. There is an option “changes without PR”

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events