How to add Branch Permissions to a repository in Bitbucket

Posted on 153 views

There are those repositories that have extremely sensitive pipelines in your Bitbucket and they must have the right permissions so that sanity and checks can be achieved. We recently showcased how to manage Cloudflare records via Terraform and Bitbucket Pipelines and such is the kind of repository that you should protect. This is because DNS records cannot be played around with and everyone in the team needs to be careful especially if you have multiple applications spread all over the place.

It is because of that that we are setting up branch permissions where we will specify who will have access to the branch, how we would like our Pull requests/Merge requests to take place and others as we we will see. So stay tuned to the end.

Step 1: Login to your Bitbucket Space

Of course we have to log into our specific Bitbucket spaces where our repositories reside. Kindly do so and navigate to your repository of interest.

Step 2: Repository Settings

Click on the repository settings where it will lead to a page with all the settings we would like to change. For this brief guide, let us focus on Branch Permissions.


That will open the page below

Step 3: Branch Permissions

On the left pane from Step 2, click on “Branch Permissions”. If there were no permissions previously, there will be a page asking you to add new permissions. Since that is what we want to do, click on “Add a branch permission”.


That will open a new page as shown below with all the settings we can alter to our desired state.


You can for example add a given number of reviewers that must approve a pull request before a merge happens, lock out direct editing of the main branch, prevent direct commits to a given branch and so forth. It is highly flexible and can fit any number of rules you would wish to enforce on your repository.

Closing Chymes

Hoping that the brief guide was as helpful as we intended, I think it is time that we finally conclude and let the year roll with a huge pinch of blessings, progress, more tech and more Love.


Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.