禁用推送到GitHub上的特定分支 [英] Disable push to specific branches on GitHub

查看:840
本文介绍了禁用推送到GitHub上的特定分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GitHub公司帐户上有一些Git私人存储库,我不希望任何人推动某些特定的分支(如master,develop和beta或按模式)。我也试着定义一些钩子,但是我希望这可以在GitHub上完成,而不是通过客户端上的预先推送钩子完成。

所以为了解释我的问题,我想:

  git push origin develop 

被服务器拒绝(这是 GitHub ),因为分支名称,但我不希望客户端通过预先挂钩检查,我真的希望GitHub做检查并拒绝它。



另外,如果可以只允许某些用户这样做,但为每个人禁用它就足够了。

解决方案

好的,经过长时间的聊天后,我从IRC那里得到了答案。我必须使用fork和pull请求,或者在每个dev的机器上添加pre-push钩子,因为GitHub不允许每个分支的权限,也不会预先发布取消钩子。以下是我得到的答案的一部分:


分发存储库。那么开发人员可以使用他们自己的版本库,而不必担心提交到错误的分支。然后,上游的某个人总是可以合并到任何分支应该承诺的范围内。


是的,但我们是公司,我们不希望我们所有的开发者都有分叉


为什么不能?

$ b $例如,他们应该能够将他们的分支推到一个通用的仓库上,与其他一些开发者一起工作。例如,

阅读 https://help.github.com/articles/using-拉请求的。您仍然可以在多个叉子之间发送补丁。这是git构建的模型


我知道,但我希望能够以中心方式快速查看实际工作任何功能/修补程序,...


长话短说:GitHub不支持每个分支的权限



I have some Git private repositories on a GitHub company account, and I don't want anybody to push on some specific branches (like master, develop and beta or by pattern). I also tried to define some hooks but I want this to be done on GitHub and not done with a pre-push hook on the clients.

So to explain my problem simply, I want:

git push origin develop

to be refused by the server (which is GitHub) because of the branch name, but I do not want a client check by pre-push hook, I really want GitHub to do the check and refuse it.

Also if it's possible to allow only certain users to do so, but disabling it for everybody would be enough at first.

解决方案

Ok I got the answer from IRC after a long chat. I'll have to work with forks and pull requests, or add pre-push hooks on each dev's machine since GitHub doesn't allow per branch permissions neither pre-publish canceling hooks. Here is a part of the answers I got:

Fork the repository. then the developer can work on their own version of the repository, and doesn't have to worry about committing to the wrong branch. And then someone upstream can always merge into whatever branch should be committed into.

Yeah but we're a company and we don't want that all our devs have forks

Why not?

Well they should be able to push their branch on a common repo to work with some other devs on the same feature for example.

Have a read through https://help.github.com/articles/using-pull-requests. You can still send patches around between multiple forks. This is the model that git was built on

I know but I want to be able to see quickly in a central way the actual work on any feature/hotfix, ...

To cut a long story short: GitHub doesn't support per-branch permissions

这篇关于禁用推送到GitHub上的特定分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆