2011-08-11 92 views
1

我的设置是Ubuntu - gitolite - msysgit。下面这个教程后:无法用新用户克隆git存储库

https://sites.google.com/site/senawario/home/gitolite-tutorial

,一切工作正常。

所以我修改和COMMITED - 推配置文件:

repo gitolite-admin 
     RW+  = id_rsa 

repo testing 
     RW+  = @all 

repo project-euler 
     RW+  = tester 

Everyhting得到了更新等

我现在想用“测试”的用户来测试这一点,但我不能。不应该git clone tester @ myServer:project-euler工作吗?

如果我尝试上面我得到:

$ git clone [email protected]:project-euler 
Cloning into project-euler... 
Permission denied (publickey). 
fatal: The remote end hung up unexpectedly 

我想这从我用来管理git的同一台机器。

如果我尝试使用此:

git [email protected]:project-euler 

我得到:对于拒绝id_rsa

这是正常的,我认为,因为git的用户不能访问项目 - 欧拉R接入。

任何想法?

在遵循@VonC链接之后,我创建了如上所述的配置文件。我仍然遇到同样的问题,所以我在用户遇到麻烦时就开始使用ssh -v。输出是:

OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007 
debug1: Reading configuration data /c/Users/Stefanos/.ssh/config 
debug1: Applying options for 192.168.1.3 
debug1: Connecting to 192.168.1.3 [192.168.1.3] port 22. 
debug1: Connection established. 
debug1: identity file /c/Users/Stefanos/.ssh/tester type 1 
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p1 Debian-1ubuntu3 
debug1: match: OpenSSH_5.8p1 Debian-1ubuntu3 pat OpenSSH* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_4.6 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-cbc hmac-md5 none 
debug1: kex: client->server aes128-cbc hmac-md5 none 
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
debug1: Host '192.168.1.3' is known and matches the RSA host key. 
debug1: Found key in /c/Users/Stefanos/.ssh/known_hosts:1 
debug1: ssh_rsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey 
debug1: Next authentication method: publickey 
debug1: Offering public key: /c/Users/Stefanos/.ssh/tester 
debug1: Authentications that can continue: publickey 
debug1: No more authentication methods to try. 
Permission denied (publickey). 

UPDATE

我设法使用Git clong git的@服务器克隆回购:回购 - 不测试仪@服务器:回购。

此外,如果我有配置文件,我不能以管理员身份登录。它仅作为测试者记录。可能应该有一种方法来配置它。感谢你的帮助。

+0

你有没有复制*测试者的公钥*? – Simon

+0

我将它们复制到/ keydir目录中,然后使用我的git帐户推送更改。一切正常。我仔细检查了删除存储库并再次克隆,然后检查新密钥是否在那里(它是)。 – FailedDev

回答

1

首先要做的是检查该新用户的公钥是否已发布到gitolite服务器。

  • 检查〜混帐/的.ssh/authorizedkeys的内容,并在它
  • 寻找与测试线检查gitolite管理员回购/ keydir的内容,并寻找一个“tester.pub”文件,在它的公共密钥(不要忘记those public keys are named after the usertester.pub这里)
  • 检查仪确实对他/她的.sshid_rsaid_rsa.pub
+0

感谢您的回复!我确实已经检查了〜git/.ssh/authorizedkeys,并且关键在那里,当然还有git语法“command etc”,但是关键在那里,就像管理员密钥一样。另外tester.pub也在服务器的/ keydir中。 对于第三部分,我需要我的机器(Win7的)上创建另一个帐户,然后放在C:/Users/tester/.ssh/the私钥? – FailedDev

+0

@FailedDev:钥匙在这里,但你能复制那一行吗?只是为了检查它是否有正确的名称。 – VonC

+0

@FailedDev:你不需要创建任何新的账户,你只需要在提交你的ssh请求时选择正确的公钥/私钥。看到这样的配置文件中http://stackoverflow.com/questions/5357232/nbgit-to-remote-host-with-ssh/5357423#5357423或http://stackoverflow.com/questions/922210/unable-to-git -push-master-to-github/922461#922461 – VonC

0

你让gitolite用户和linux用户混淆。他们有一些共同的特点,但在其他方面有所不同您连接到gitolite时,您总是在中使用git URL中名为“git”的用户。无论如何,无论您尝试连接的用户都必须有密钥对(〜/ .ssh/id_rsa [.pub])。所以,假设你是“bob”。您的公钥位于/home/bob/.ssh/id_rsa.pub。该公钥必须添加到gitolite配置中。假设你在添加它时将其命名为“foo.pub”。现在“foo”是一个有效的gitolite用户,你可以在config中参考。请记住,本地用户(bob),用于连接gitolite(git)的用户和gitolite用户(foo)之间没有任何隐式或显式连接。唯一的连接是公钥,它将本地计算机上的“bob”标识为gitolite的“foo”。

+0

所以我想,无论是在配置文件中,定义这意味着有可能是当前用户每个机器在任何给定时间点只有一个用户。这是罚款,我想:) – FailedDev

+0

@Failed:不,实际上gitolite你能说出你的PUBKEY文件,如“[email protected]”,“[email protected]”,或“[email protected]”以给单个用户多个密钥。 “@.pub”中的名称并不重要。它仅供参考gitolite管理员参考。 –