Using gitosis to specify permissions per branch?

落爺英雄遲暮 提交于 2019-12-18 20:02:10

问题


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

回答1:


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.




回答2:


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 or git-daemon integration, but it does now.




回答3:


This script seems to do per branch access control:

http://www.kernel.org/pub/software/scm/git/docs/howto/update-hook-example.txt




回答4:


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.



来源:https://stackoverflow.com/questions/579714/using-gitosis-to-specify-permissions-per-branch

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