使用 gitosis 指定每个分支的权限?
使用gitosis,是否可以指定写权限,以便用户可以自由地推送到具有自己名称的分支,但不能与master合并? 例如 $USER/test1 .. $USER/test5
这意味着您可以为每个项目仅托管一个存储库,而不是为同一项目托管特定于每个用户的多个存储库:
project1-user1
project1-user2
project1-user3
...
project5-user1
project5-user2
project5-user3
With gitosis, is it possible to specify write permissions so that users can push freely to branches with their own name, but not merge with the master? E.g. $USER/test1 .. $USER/test5
This mean you could host just one repository per project, rather than hosting multiple repositories for the same project, specific to each user:
project1-user1
project1-user2
project1-user3
...
project5-user1
project5-user2
project5-user3
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Gitolite 项目提供了此功能。 它是用 Perl 重写的 Gitosis。 它的代码可以在在github上找到
当我第一次写这个答案时,它不支持
gitweb
或git-daemon
集成,但现在确实如此。The Gitolite project offers this functionality. It's a rewrite of Gitosis in Perl. Its code can be found on github
When I first wrote this answer, it didn't support
gitweb
orgit-daemon
integration, but it does now.该脚本似乎对每个分支进行访问控制:
http://www.kernel.org/pub/software/scm/git/docs/howto/update-hook-example.txt
This script seems to do per branch access control:
http://www.kernel.org/pub/software/scm/git/docs/howto/update-hook-example.txt
Gitosis 控制对存储库的访问,但不是通过分支或提交来控制。 因此,您可以将主库本身放入具有只读访问权限的存储库中,并让用户将其各自的分支推送到另一个存储库(或者如您所说,每个用户一个)。 我还没有看到有人扩展 gitosis 来进行更细粒度的控制。
如果您确实需要限制用户的访问权限并且想要使用 Git,那么也许您应该只通过电子邮件获取补丁并将存储库保持为只读。
Gitosis controls access to repositories, but not by branch or commit. So you could put the master in a repo by itself which had read-only access and let users push their individual branches to another repo ( or one per user, as you say). I haven't seen anyone extend gitosis for finer-grain control.
If you really need to restrict your users' access that much and you want to use Git, then perhaps you should only take patches by e-mail and keep your repo as read-only.
Gitolite 很好地支持分支或标签名称的权限。
在 Pro GIT 书中,本节详细解释了如何设置和配置每个分支访问权。 在该页面中搜索“配置文件和访问控制规则”。
Gitolite supports permission by branch or tag names quite well.
In the Pro GIT book, this section explains in detail how to set it up and configure per branch access right. Search "Config File and Access Control Rules" within that page.