在Linux服务器上设置git

时间:2012-05-11 14:42:26

标签: linux authentication github redhat ssh-keys

我正在尝试在运行Linux RedHat的服务器上设置一个git repo。

我按照Github帮助页面上的说明操作。我到达指令告诉我ssh到git@github.com的步骤。

这给了我以下错误 -

 $ ssh -T git@github.com
 Permission denied (publickey).

然后我做了$ ssh -vT git@github.com并得到了这个 -

 OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
 debug1: Reading configuration data /home/min/a/foo/.ssh/config
 debug1: Applying options for *
 debug1: Reading configuration data /etc/ssh/ssh_config
 debug1: Applying options for *
 debug1: Connecting to github.com [some IP] port 22.
 debug1: Connection established.
 debug1: identity file /home/shay/a/foo/.ssh/id_rsa type -1
 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-6+squeeze1+github2
 debug1: match: OpenSSH_5.5p1 Debian-6+squeeze1+github2 pat OpenSSH*
 debug1: Enabling compatibility mode for protocol 2.0
 debug1: Local version string SSH-2.0-OpenSSH_5.3
 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: Host 'github.com' is known and matches the RSA host key.
 debug1: Found key in /home/min/a/foo/.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: Trying private key: /home/shay/a/foo/.ssh/id_rsa
 debug1: No more authentication methods to try.
 Permission denied (publickey).

这是我现在的位置 -

 $ pwd
 /home/min/a/foo/.ssh

我不明白出了什么问题?此外,如果我尝试通过执行ssh-add添加此路径,则会显示“无法打开与身份验证代理的连接”。

2 个答案:

答案 0 :(得分:0)

您似乎没有将密钥上传到github,或者您上传的密钥与当前用户的默认密钥不匹配。

检查您的本地密钥是否在github上:

或者,检查您的密钥是否已在github上启用 。不久前,有一个security issue related to ssh keys on github。禁用所有ssh密钥以强制用户查看其允许的密钥列表。如果您最近没有使用过github,那么您仍然可能被禁用。

答案 1 :(得分:0)

如果有人感兴趣或有类似的问题并检查这篇文章,解决方法是从.ssh dir和ssh进入github。如果在github的帮助页面上完全遵循其他所有内容,这将解决问题。