我已经设置了gitosis,并能够通过ssh拉/推。 Gitosis安装在Debian Lenny服务器上,我从Windows机器(msysgit)使用git。 奇怪的是,如果我在gitosis.conf中启用了loglevel = DEBUG在使用gitosis服务器执行任何操作时,我会看到类似下面的内容:
D:\Kaze\source\test-project>git pull origin master DEBUG:gitosis.serve.main:Got command "git-upload-pack 'test_project.git'" DEBUG:gitosis.access.haveAccess:Access check for '[email protected]' as 'writable' on 'test_project.git'... DEBUG:gitosis.access.haveAccess:Stripping .git suffix from 'test_project.git', new value 'test_project' DEBUG:gitosis.group.getMembership:found '[email protected]' in 'test' DEBUG:gitosis.access.haveAccess:Access ok for '[email protected]' as 'writable' on 'test_project' DEBUG:gitosis.access.haveAccess:Using prefix 'repositories' for 'test_project' DEBUG:gitosis.serve.main:Serving git-upload-pack 'repositories/test_project.git' From 192.168.175.128:test_project * branch master -> FETCH_HEAD Already up-to-date.
问题是:为什么我是[email protected] ? 这个电子邮件也在全局的user.emailconfigurationvariables中。
昨天,当gitosis被安装时,它被视为Kaze @ KAZE ,这是我被添加到gitosis-admin组(它工作)的名字。 但今天git(或gitosis)开始把我看作[email protected] 。 对于我推送或克隆的所有存储库都是如此。 我不得不直接在服务器上添加这个地址到gitosis.conf ,以便能够再次编辑configuration(它工作)。 keydir有两个公钥: [email protected]和[email protected] ,它们的内容是一样的,最后是kaze @ KAZE 。 源URL看起来像git@lennyserver:test_project 。
现在,问题是 – 为什么Git(或gitosis)突然决定通过电子邮件而不是名称@ machinename给我打电话? 我已经改变了一些事情,试图设置Gitosis(例如更新服务器上的git为1.6.0),但也许我打破了我的本地git安装?
从Gitosis的观点来看,你的名字就是你用keydir命名的keydir的名字。 除了影响您使用的公钥以外,本地计算机上的任何configuration都不重要,密钥末尾的string无关紧要 – 只是文件名。
你已经给了你的公钥两个名字,所以当你用这个密钥进行身份validation的时候,当它为这个密钥寻找一个名字的时候,它是不确定的。 当你在Gitosis中改变了一些其他的东西的时候,想必它改变了它find的名字的任意select。
(具体来说,我相信Gitosis会生成自己的authorized_keys来包含keydir所有键,每行一个,并提供一些选项来告诉sshd只允许用户以受控的方式运行Gitosis,并告诉Gitosis键的名称。如果多行具有相同的密钥,我不确定哪一个sshd最终会使用 – 也许是第一个,也许是最后一个,也许是任意的.Gitosis写入它们的顺序也可以是任意的。这个任意select是如何发生的,因为没有人保证他们在下一次更新sshd或gitosis时不会改变。)
你应该select你想要在Gitosisconfiguration中使用哪个名字来引用你自己,然后在keydir只保留你的密钥副本。