我已经使用Gitosis设置了我的git服务器。 我需要在同一台机器上以不同的用户签出资料库。
假设有两台机器:
我怎样才能签出回购为“Dev1”的Windows机器,也作为“tech_geek”? 所以在Windows机器上会有两个存储库被检出。
1)克隆Gitosispipe理员回购:
$ git clone git@SERVER:gitosis-admin.git
2)将Dev1和tech_geek的SSH公钥添加到gitosis-admin/keydir (将每个公钥id_rsa.pub重命名为dev1.pub和tech_geek.pub) 。 添加到文件gitosis-admin/gitosis.conf
[group developers] members = dev1 tech_geek [group new_project] writable = new_project members = @developers
其中new_project是回购名称(没有.git后缀)
3)承诺和推动
$ cd gitosis-admin $ git add . $ git commit -m "New devs and repo for new_project" $ git push
4)尝试从Windows主机克隆回购(用户Dev1或tech_geek)
$ git clone git@SERVER:new_project.git
现在使用环境variablesGIT_SSH_COMMAND。 (GIT_SSH_COMMAND =“ssh -i〜/ .ssh / id_rsa_example”git clone example)
请参阅: https : //superuser.com/questions/232373/how-to-tell-git-which-private-key-to-use
如果您使用其中一种GUI工具,则可能更容易select密钥。