生成的密钥,添加到我的帐户,ssh无法正常工作(权限被拒绝)

时间:2014-03-26 21:32:37

标签: git cloudbees

我在Mac OS 10.9上。 我用ssh-keygen生成了我的ssh密钥。我将pub密钥粘贴为我帐户中的新安全密钥。我重新启动了电脑。然后 $ ssh git@git.cloudbees.com回声 权限被拒绝(公钥)。

我试了好几次没有进展。 我浏览了一些想法,却没有找到任何帮助。

以下是针对服务器的验证记录:

MacBook-Pro-de-Ludovic:~ Ludo$ echo | ssh -v -i ~/.ssh/id_rsa git@git.cloudbees.com echo
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to git.cloudbees.com [54.235.125.211] port 22.
debug1: Connection established.
debug1: identity file /Users/Ludo/.ssh/id_rsa type 1
debug1: identity file /Users/Ludo/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0
debug1: match: OpenSSH_6.0 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
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
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 34:fe:24:48:6c:46:ff:1c:96:fc:d0:b6:7f:f8:51:e5
debug1: Host 'git.cloudbees.com' is known and matches the RSA host key.
debug1: Found key in /Users/Ludo/.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: Roaming not allowed by server
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 RSA public key: /Users/Ludo/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: /Users/Ludo/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

感谢您的帮助!

3 个答案:

答案 0 :(得分:1)

根据你的日志,它看起来真的是使用了错误的ssh密钥。

我创建了一个帐户,添加了一个我用ssh-keygen生成的新ssh密钥(没有参数)

调试代码段显示以下内容;

debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).

ssh-keygen -l显示的指纹与cloudbees门户中显示的指纹相匹配。

它有点紧张,但是......你能告诉我你添加到ssh-keygen&#39;生成密钥时?您可能偶然发现了不受支持的密钥格式..

否则,请使用新密钥再次启动..

答案 1 :(得分:0)

权限被拒绝错误意味着没有向SSH服务器提供已知密钥。

要测试CloudBees是否具有您希望正确注册的密钥,请执行以下操作:

echo | ssh -v -i ~/.ssh/id_rsa git@git.cloudbees.com echo

这将显示SSH客户端活动的痕迹。

如果这样可行,那么您的git客户端可能没有正确使用SSH。

答案 2 :(得分:0)

我在Windows 7和MINGW32上遇到了同样的问题(完全相同的ssh日志,相同的cloudbees主机密钥指纹)。

我知道你的是在Mac OS上,但我找到了一个解决方法,我希望这可以帮助其他人。

本文介绍了问题:http://guides.beanstalkapp.com/version-control/git-on-windows.html#openssh-windows-7 他们建议在git中使用PuTTY而不是OpenSSH,比如@ d_rez90提出的,作为一种解决方法。 (对我来说很好)