Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restrict certain GitHub users to merge branches

Is it possible to restrict certain git users to merge git branches on GitHub? I want to let users commit, pull and push changes in current branch, switch to another existing branch, but do not allow to merge branches. Is it possible on GitHub.com or standalone git repository?

like image 763
HitOdessit Avatar asked Mar 03 '12 10:03

HitOdessit


2 Answers

If your repository is under an organization on Github, you can add the developers to a read-access team. That way they can see and check out the repository but can't commit to it. They can also fork the repository, which lets them do their work in their fork then submit pull requests to get their work committed to the main repository.

You can then grant write access to only certain developers who will be in charge of reviewing and merging pull requests.

like image 159
Michael Melanson Avatar answered Oct 08 '22 16:10

Michael Melanson


No. The only way to prevent things like this are git's internal pre-commit or update hooks. Those hooks get called before to push is accepted.

GitHub itself doesn't support pre-commit or update hooks. Only web hooks are supported. But these are called after the push. So too late to prevent certain types.

like image 31
iltempo Avatar answered Oct 08 '22 16:10

iltempo