1

Would it be possible to restrict developers not to create a branch in gitlab? Only Owner or Maintainer should create.

Any help would be appreciated.

kcg7kcg
  • 11
  • 2

2 Answers2

0

You should be able to using protected branches.

Go to Settings -> Repository, and navigate to Protected Branches.

You can then create a wildcard to protect all branches, and only allow Maintainers or Owners to push/merge.

Rekovni
  • 6,319
  • 3
  • 39
  • 62
  • 1
    Thanks for your response for protecting existing branches. But is there any way to revoke rights or restrict developers from creating a new branch in gitlab? – kcg7kcg Jul 02 '20 at 22:31
  • The above should do the trick. If you have a wildcard like `*`, and only allow Maintainers and above to push, it should prevent developers from pushing any branch to GitLab. Does this solution not work? – Rekovni Jul 03 '20 at 09:09
0

After a lot of internet searching, I don't think you can stop specific users from creating new branches. Although, most of the suggestions given to accomplish some sort of control is to use protected branches.

Most suggestions along this route tell you to restrict branch creation for individuals with the "Developer" role, while allowing those with "Maintainer" role to continue creating branches on GitLab.

But, my use case desires the ability to restrict only some of the users with "Developer" access. My team is quite large, and I only want to restrict a small percentage of them from creating branches. I don't want to have to make the majority of my developers into "Maintainers" just to accomplish this restriction. Thus, I believe that restricting branch creation by individual user is not possible with GitLab at this time.

twindham
  • 930
  • 9
  • 31