3

Does anyone know of a hook for GitHub Enterprise which will allow me to only have certain accounts on a repository commit to certain branches? Sorry if this is a basic question just kicking off this GitHub stuff.

What I am setting up is a public project - All engineers can push and pull Master Branch is controlled by Dev Lead and is only the shipping code. Development branch is where all dev happens.

I want to make sure that and engineer not authorized does not commit to master. and if they try it will be kicked back

iOSGuy
  • 61
  • 1
  • 4
  • See [my edited answer below](http://stackoverflow.com/a/24709530/6309): this should be available soon. – VonC Sep 03 '15 at 19:33

2 Answers2

1

Note: if the GitHub pull-request workflow isn't your cup of tee, BitBucket offers protected branches which can be closer to what you were looking for initially.

The branch management includes "limit push" powers:

You can set rules that limit who can push to a branch. Rules specify the groups and/or users that can push to a branch. Any user that doesn't meet the rule can't push to a repository. You can only create rules for users and groups that have write permissions or higher.

This kind of feature isn't available yet on GitHub.


Update September 2015:

That feature is now close to be available, with "Protected branches and required status checks" (September 3, 2015)

It will allow you to protect a branch:

  • against forced pushed
  • against deletion
  • against merged changes until required status checks pass

https://cloud.githubusercontent.com/assets/25792/9596474/27db3ce6-502a-11e5-9b19-5b47a8addc65.png

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Instead of giving your employees push access to specific branches, just give them read-only access.

Each contributor can then fork the main repository, push commits to their own repo, And ask the dev lead to merge pull requests.

That way, the dev lead must approve all code integrations, and nobody will accidentally make commits on or edit the history of master.

jshawl
  • 3,315
  • 2
  • 22
  • 34