我需要锁定 git 仓库的主分支。我尝试了预提交 Hook ,但它们只是客户端 Hook ,但我想锁定大多数用户的主分支。谁能告诉我 git 上的预接收 Hook 的步骤(我使用 github)或锁定 master 的任何更好的方法?
PS:我们的 github 许可版本不支持 gitolite。
最佳答案
GitHub 许可意味着“GitHub:enterprise
”,正如文章“Migrating from GitHub:FI”中所解释的那样:不允许自定义 Hook 。
(另见“How can I add a custom git hook to a GitHub Enterprise repo?”)
所以我会采用不同的方法,在该服务器上维护的不是一个存储库,而是两个存储库(第二个是第一个的克隆)。
每个人都可以推送到第一个,但只有选定的用户可以推送到第二个,这允许他/她从第一个 repo 中选择有资格推送到第二个的内容。
因此,“repo2
”在某种程度上代表您的“master
”,而“repo1
”代表所有其他用户可以推送的任何其他分支到。
这个有点类似这个GitHub gist article .
I suggest separating the release engineering team into their own organization.
The developers will have to fork all of the repositories residing in the release engineering team.
The developers will be able to commit tomaster
within their organization.
They must send pull requests in order to get their commits into therelease_engineering
organizations.Note: It will take some time to convince the customer that committing to the
master
branch ofacme_developers/foobar
is distinct from committing to themaster
branch ofacme_release_engineering/fooba
.
关于git - 如何锁定git repos master分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12229810/