1

I am using Atlassian Bitbucket server v4.8.6.

How do I restrict restrict branch creation based on pattern.

Rules explained below -

  1. Only ABC team should be able to create release/ABC-*
  2. Only XYZ team should be able to create personal/XYZ-*
kishs1991
  • 969
  • 4
  • 10
  • 16

2 Answers2

3

You can't create rules to prevent only the "creation" of branches. These are the avaliable restrictions:

Prevent all changes
Prevent deletion
Prevent rewriting history
Prevent changes without a pull request

To create branch permissions do the following:

  1. Go to Repository > Settings > Branch permissions > Add permissions
  2. Select "Branch pattern"
  3. Add branch pattern, ex: release/ABC-*
  4. Select one of the restrictions available
  5. Add the group exception, ex: ABC
papanito
  • 2,349
  • 2
  • 32
  • 60
-4

This can be done by adding "*" on Select branch text field. See the screenshot below.

  1. Go to your repository > Settings > Branch permissions > Add permission

  2. Under "Select branch - By name or pattern", put an asterisk (*)

  3. Save

Add a branch permission

After that, you can restrict each branch patterns you want for different teams or people.

ABC group

  1. Select branch = release/ABC-*

  2. Write access = ABC group or ABC members

Personal branch

  1. Select branch = personal/XYZ-*

  2. Write Access = Your account

  • Branch pattern '*' overlaps all other branches too – House Nov 20 '20 at 03:40
  • this does not work. the * restricts everything, you cant then unrestrict things under that. I want to make sure nobody can make a branch thats not in a folder (ie, feature/xyz is allowed but xyz in the "root") Also would like to make sure a feature/ branch has to start with a jira ticket number, but thats not possible either... – Greywire Jul 01 '22 at 15:03