“隐藏” GIT 中的东西
这里是 Git 菜鸟。
我知道这违反了“分布式源代码控制”的原则,但我想“密码保护”我的 GIT 存储库中的某些开发分支。也就是说,我不希望通过 gitbranch -r 来使用该分支,除非需要通过某种密码访问该分支的特定开发人员组。
可能的?
Git noob here.
I know this is against the principal of "distributed source control" but I want to "password protect" certain development branches in my GIT repository. That is, I don't want that branch to be available via git branch -r
, except to a certain group of developers who need access to that branch, via some sort of password.
Possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以从公共存储库克隆一个单独的存储库,并拥有自己的分支。
该存储库可以位于具有正确 ACL 或组权限的文件系统中,也可以是需要正确登录凭据等的单独服务器。然后开发人员可以根据授权进行提交、拉取、合并等操作。
You can have a separate repository cloned from the public one with its own branches.
This repository could be in the filesystem with the right ACLs or group permissions, or it could be a separate server requiring proper login credentials, etc. Then developers could commit, pull, merge, etc. as authorized.
为什么不创建一个单独的 git 存储库并只允许您和特定的开发人员组访问(这可以使用 gitosis)?
如果您还没有使用 gitosis,我建议您这样做。
Why not make a separate git repository and allow only you and that certain group of developers access (this can be accomplished using gitosis)?
And if you are not already using gitosis, I suggest you do so.
我认为这是不可能的。这将使合并之类的事情几乎不可能,因为 git 需要了解分支才能进行合并。考虑这样一种情况,您信任的开发人员之一将某些内容从隐藏分支合并到您的主分支。然后,一个不受信任的开发人员尝试合并他的更改 ->你会如何解决这些冲突?
但获得您想要的东西很简单:只需拥有一个单独的存储库并将其用作“分支”,因为从不同的存储库合并与合并同一存储库中的分支一样简单。
I don't think this is possible. It would make things like merging near impossible since git needs to know about the branches in order to make a merge. Consider the situation where one of your trusted developers merge something from the hidden branch to your main branch. Then a non-trusted developer tries to merge his changes -> how would you resolve the conflicts?
But it's simple to get what you want: just have a separate repository and use that as a "branch" since merging from a different repository is about as easy as merging a branch in the same repository.