Gitolite安装:我无法克隆gitolite-admin仓库!

7
我正在尝试在我的Ubuntu服务器上安装gitolite。
虽然还有很多东西我还不知道,但是我正按照它的指示(http://sitaramc.github.com/gitolite/doc/1-INSTALL.html)非常缓慢地前进。
  1. 我的服务器账户是'yoon',使用ssh-keygen命令生成的密钥对没有密码(只需按回车键),然后将公钥复制到/tmp目录并chmod 777。
  2. 使用'sudo apt-get install gitolite'安装gitolite,它也创建了gitolite账户(输出的最后一行是No adminkey given - not initializing gitolite in /var/lib/gitolite.
  3. 使用'sudo su gitolite'更改用户并执行'gl-setup /tmp/id_rsa.pub'
  4. 返回到我的账户(yoon)并运行'git clone gitolite@myserver.com:gitolite-admin',然后它要求输入gitolite@yoonha.iptime.org's password
  5. 如果我按回车键,因为创建密钥对时没有输入任何密码短语,终端会显示Permission denied, please try again
请让我提供任何线索~ 谢谢!
+ 我正在使用同一台机器作为服务器和客户端。
+ ssh -vvv命令的完整列表
yoon@ubuntu:~$ ssh -vvv gitolite@myserver.com
OpenSSH_5.5p1 Debian-4ubuntu5, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to myserver.com [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug3: Not a RSA1 key file /home/yoon/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/yoon/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/yoon/.ssh/id_rsa-cert type -1
debug1: identity file /home/yoon/.ssh/id_dsa type -1
debug1: identity file /home/yoon/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-4ubuntu5
debug1: match: OpenSSH_5.5p1 Debian-4ubuntu5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.5p1 Debian-4ubuntu5
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 126/256
debug2: bits set: 503/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: host myserver.com filename /home/yoon/.ssh/known_hosts
debug3: check_host_in_hostfile: host myserver.com filename /home/yoon/.ssh/known_hosts
debug3: check_host_in_hostfile: host myserver.com filename /etc/ssh/ssh_known_hosts
debug3: check_host_in_hostfile: host myserver.com filename /etc/ssh/ssh_known_hosts
debug3: check_host_in_hostfile: host xxx.xxx.xxx.xxx filename /home/yoon/.ssh/known_hosts
debug3: check_host_in_hostfile: host xxx.xxx.xxx.xxx filename /home/yoon/.ssh/known_hosts
debug3: check_host_in_hostfile: host xxx.xxx.xxx.xxx filename /etc/ssh/ssh_known_hosts
debug3: check_host_in_hostfile: host xxx.xxx.xxx.xxx filename /etc/ssh/ssh_known_hosts
debug3: check_host_in_hostfile: host myserver.com filename /home/yoon/.ssh/known_hosts
debug3: check_host_in_hostfile: host myserver.com filename /etc/ssh/ssh_known_hosts
debug2: no key of type 0 for host myserver.com
debug3: check_host_in_hostfile: host myserver.com filename /home/yoon/.ssh/known_hosts2
debug3: check_host_in_hostfile: host myserver.com filename /etc/ssh/ssh_known_hosts2
debug3: check_host_in_hostfile: host myserver.com filename /home/yoon/.ssh/known_hosts
debug3: check_host_in_hostfile: host myserver.com filename /etc/ssh/ssh_known_hosts
debug2: no key of type 2 for host myserver.com
The authenticity of host 'myserver.com (xxx.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is d4:5d:af:76:51:63:42:7d:ed:43:5f:bf:17:c6:c3:d4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'myserver.com,xxx.xxx.xxx.xxx' (RSA) to the list of known hosts.
debug2: bits set: 503/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/yoon/.ssh/id_rsa (0x7fc8e9b596b0)
debug2: key: /home/yoon/.ssh/id_dsa ((nil))
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/yoon/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/yoon/.ssh/id_dsa
debug3: no such identity: /home/yoon/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
gitolite@myserver.com's password:
debug3: packet_send2: adding 64 (len 53 padlen 11 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
gitolite@myserver.com's password:
debug3: packet_send2: adding 64 (len 53 padlen 11 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
gitolite@myserver.com's password:
debug3: packet_send2: adding 64 (len 53 padlen 11 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey,password).
2个回答

13

终于,我从自己那里得到了答案!

gitolite 用户由 Debian 软件包 gitolite 自动创建,但不允许通过 sshd 登录。所以我已经在 sshd_config 文件中将 gitolite 添加到 AllowUsers 中。

哇~~~


1
这个解决方案对我很有效,因为我的服务器上有“permitrootlogin no”。对于那些想尝试这个解决方案但不知道该怎么做的人:输入“sudo nano /etc/ssh/sshd_config”,然后在底部添加“AllowUsers gitolite”(不带引号)。 - matthewdaniel
现在它正在工作,你的.ssh/authorized_keys文件和gitolite信息以及.gitosis-admin目录是在/home/gitosis还是在/root中?我遇到了你之前遇到的同样的问题,但修复方法不起作用,而这些文件对我来说是放在root中的,看起来它们应该放在gitosis中。 - sak
在我的机器(Synology)上,我将用户“git”的/etc/passwd的shell条目从/sbin/nologin更改为/bin/sh - Patrick B.

1
无论何时一个基于ssh的操作要求输入密码,很可能是因为:
  • (监听您请求的ssh守护进程)在 ~gitolite/.ssh/authorized_keys 文件中找不到公钥。
    在Gitolite安装包方法中,这就是 gl-setup应该做的事情(第91行+)
    请检查~gitolite/.ssh/authorized_keys是否正确填充和保护。

  • 或者您的私钥(id_rsa)不在它应该在的地方(即您自己的$HOME/.ssh


  1. [command="/usr/share/gitolite/gl-auth-command id_rsa",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa blahblah... myaccount@myserver] 存在于 ~gitolite/.ssh.authorized_keys 文件中。
  2. 我的客户端的 .ssh 目录中有 id_rsa 和 id_rsa.pub。
- Hongseok Yoon
我刚刚发布了编辑我的问题的结果,非常感谢! - Hongseok Yoon
@Hongseok:嗯...也许https://bbs.archlinux.org/viewtopic.php?id=55471可以帮助。尝试重新创建您的密钥(公钥和私钥),并通过`gl-setup`重新发布您的私钥。如果仍然无法正常工作,我提到的主题还涉及到`sshd_config`文件,这也可能解释您的错误消息。 - VonC
@Hongseok:例如,上面的线程提到:“至少对我来说,这个错误是由于我的/etc/hosts.allow/etc/hosts/deny不允许sshd访问sshd引起的。显然,我只需在/etc/hosts.allow中放置“sshd: ALL”,它就开始工作了。” - VonC
@Hongseok:请确保您生成了RSA密钥(http://www.unix.com/red-hat/144991-unable-ssh-into-machine-ssh_exchange_identification-connection-closed-remote-host.html)。关于我之前关于host.allow的评论:https://bbs.archlinux.org/viewtopic.php?pid=422485(另一个说明) - VonC
显示剩余5条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接