GitHub Enterprise Hook to only allow certain users to commit?

霸气de小男生 提交于 2019-12-07 17:54:17

问题


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


回答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




回答2:


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.



来源:https://stackoverflow.com/questions/24707658/github-enterprise-hook-to-only-allow-certain-users-to-commit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!