Github private repository master branch protection

2.5k Views Asked by At

we had an incident one of our devs merged into master branch directly which shouldn't have happened.

We use "feature" branch that goes in "rc" branch directly - which will be QA'ed then merged into "master" after deployment.

I'd like to see if there is a way to restrict only "rc" branches can be merged into master and reject all other push.

Since we are using private repo, branch protection via github setting might not work, so I was looking into pre push hook, but will above scenario be possible?

Thank you.

  1. looked into github setting -> branch protection : it wasn't available for private repo
  2. looked into usage for pre push hook.. wasn't able to find good example for our usage so far.
1

There are 1 best solutions below

0
optimus_prime On

According to the GitHub docs, you'll need at least GitHub Pro to create branch protection rules with a private repo.

There are other ways to do it, but based on how much time they'll take and what a pain they'll be to deal with, $4/month for pro is almost certainly the easiest way IMO.