[英]Selective access to Git repository based on SSH
I have a server with six Git repositories, to which I have read+write access through a single SSH account, all in /opt/git/, all owned by the SSH account. 我有一台带有六个Git存储库的服务器,我可以通过一个SSH帐户对它进行读写访问,所有SSH帐户都在/ opt / git /目录中。
I'd like to give somebody else read+write access the a few of the repositories, but not to all. 我想让其他人可以读写访问一些存储库,但不是全部。
It's unlikely we'll have a third developer for quite a while, atleast not before we get a proper sysadmin, so it's okay if it's "good enough for now". 我们不太可能会有第三位开发人员在相当长的一段时间内,至少要等到获得合适的系统管理员之后,因此“现在足够好”就可以了。
That would be best managed by gitolite (an authorization layer ), which would allow you to configure a list of: 最好由gitolite ( 授权层 )管理,这将允许您配置以下列表:
And associate the users you want to the right repos. 并将您想要的用户关联到正确的存储库。
All users would still access those repos through ssh with the account git, but using their own public/private ssh keys (registered in gitolite config file), generated with a command similar to: 所有用户仍将使用git帐户通过ssh访问那些存储库,但使用其自己的公用/专用ssh密钥(已在gitolite配置文件中注册),该密钥的生成类似于以下命令:
ssh-keygen -t rsa -f "${H}/.ssh/myLogin" -C "My Gitolite access (not interactive)" -q -P ""
Each user would set up a %HOME%/.ssh/config
file in order to reference myLogin/myLogin.pub
keys. 每个用户都将设置
%HOME%/.ssh/config
文件 ,以引用myLogin/myLogin.pub
密钥。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.