Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub: Restrict Access to specific branch [duplicate]

Is there a way to restrict access to certain branches within a repository? We have production and master branches which sometimes get messed up with rogue pushes.

like image 376
Karan Verma Avatar asked Mar 20 '26 20:03

Karan Verma


1 Answers

Not with GitHub in the same repo.
(as opposed to local repos, which can be protected by an authorization layer like gitolite)

You could have:

  • one repo for production and master branch, with only the prod team as collaborators (if there need to be contribution by others, they can fork that repo)
  • one repo for other (more "public") branches, for the rest of the team.

Update: I still prefer having two repos, but you now (Sept. 2015) can protect a branch on GitHub.
See "How to protect “master” in github?".

like image 179
VonC Avatar answered Mar 22 '26 11:03

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!