1

我的设置是 ubuntu - gitolite - msysgit。遵循本教程后:

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

一切正常。

所以我修改并提交 - 推送配置文件:

repo    gitolite-admin
        RW+     =   id_rsa

repo    testing
        RW+     =   @all

repo    project-euler
        RW+     =   tester

一切都得到了更新等。

我现在想用“tester”用户对此进行测试,但我不能。git clone tester@myServer:project-euler 不应该工作吗?

如果我尝试上述方法,我会得到:

$ git clone tester@192.168.1.3:project-euler
Cloning into project-euler...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

我在我用来管理 git 的同一台机器上试过这个。

如果我尝试使用它:

git git@192.168.1.3:project-euler

我得到:项目欧拉拒绝对 id_rsa 的 R 访问

我认为这是正常的,因为 git 用户无权访问。

有任何想法吗?

在关注@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).

更新

我设法通过使用 git clong git@server:repo 克隆了 repo - 而不是 tester@server:repo。

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

4

2 回答 2

1

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

  • 查看 ~git/.ssh/authorizedkeys 的内容,并在其中查找包含 tester 的行
  • 检查 gitolite-admin repo/keydir 的内容,并寻找一个 ' tester.pub' 文件,其中包含公钥(不要忘记那些公钥是以用户命名的tester.pub这里)
  • 检查测试人员是否有他/她.sshid_rsaid_rsa.pub
于 2011-08-11T04:02:35.910 回答
0

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

于 2011-08-11T17:16:36.210 回答