在Linux服务器上设置git
我想在运行Linux RedHat的服务器上设置一个git repo。在Linux服务器上设置git
我按照Github帮助页上的说明进行操作。我达到了指示告诉我ssh到[email protected]的步骤。
这给了我下面的错误 -
$ ssh -T [email protected]
Permission denied (publickey).
于是我做了$ SSH -vT [email protected]并获得本 -
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来添加此路径,它会显示“无法打开与身份验证代理的连接”。
您似乎没有上传github的密钥,或者您上传了与当前用户的默认密钥不匹配的密钥。
检查你的本地密钥是在github:
- 让你的钥匙的指纹:
ssh-keygen -lf ~/.ssh/id_rsa.pub
- 入住这与允许密钥列表在GitHub上:https://github.com/settings/ssh
另外,检查你的密钥是在github上启用。前一阵子,有一个security issue related to ssh keys on github。所有ssh密钥都被禁用,以强制用户查看允许的密钥列表。如果你最近没有使用过github,那么你仍然可能被禁用。
不要忘记检查.ssh的_permissions_如果密码过于宽松,密钥验证将不起作用。 –
@ ThomasM.DuBuisson:这是真实的,但是在调试输出中会显示不正确的权限(太宽或太窄)(“'/home/david/.ssh/id_dsa'的权限0777太打开了。'或'无法打开密钥文件'/home/david/.ssh/id_dsa':Permission denied')。至少,这是openssh 5.9的行为(OP使用5.3)。 – vezult
我没有意识到它实际上会告诉你。很高兴知道! –
为防万一有人感兴趣或者有类似的问题并检查这篇文章,解决方法是将cd.ssh目录和ssh文件放到github中。如果提供的其他内容完全按照github的帮助页面进行,那么这将解决问题。
您是否生成/上传了您的ssh-gen密钥>? –
是的。我遵循github帮助页面上的说明,我可以在我的键盘上看到第二个键(我的笔记本电脑上已有一个键,它可以工作)。 – maverick1989