关于ssh连接主机,git连接github失败的问题:ssh -T git@github.com&&Permission denied (publickey)

来源:互联网 发布:红鸟棋牌源码三网通 编辑:程序博客网 时间:2024/06/11 14:49
关于ssh连接主机,git连接github失败的问题问题:$ ssh -T git@github.comPermission denied (publickey)解析:1、可以看出问题出在publickey(公钥)2、接着ssh -T -v git@github.com 看下具体信息penSSH_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012debug1: Reading configuration data /etc/ssh/ssh_configdebug1: /etc/ssh/ssh_config line 19: Applying options for *debug1: Connecting to github.com [192.30.252.131] port 22.debug1: Connection established.debug1: identity file /home/sunny/.ssh/id_rsa type -1debug1: identity file /home/sunny/.ssh/id_rsa-cert type -1debug1: identity file /home/sunny/.ssh/id_dsa type -1debug1: identity file /home/sunny/.ssh/id_dsa-cert type -1debug1: identity file /home/sunny/.ssh/id_ecdsa type -1debug1: identity file /home/sunny/.ssh/id_ecdsa-cert type -1debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1+github5debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1+github5 pat OpenSSH_5*debug1: Enabling compatibility mode for protocol 2.0debug1: Local version string SSH-2.0-OpenSSH_6.1p1 Debian-4debug1: SSH2_MSG_KEXINIT sentdebug1: SSH2_MSG_KEXINIT receiveddebug1: kex: server->client aes128-ctr hmac-md5 nonedebug1: kex: client->server aes128-ctr hmac-md5 nonedebug1: sending SSH2_MSG_KEX_ECDH_INITdebug1: expecting SSH2_MSG_KEX_ECDH_REPLYdebug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48debug1: Host 'github.com' is known and matches the RSA host key.debug1: Found key in /home/sunny/.ssh/known_hosts:1debug1: ssh_rsa_verify: signature correctdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: SSH2_MSG_NEWKEYS receiveddebug1: Roaming not allowed by serverdebug1: SSH2_MSG_SERVICE_REQUEST sentdebug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug1: Authentications that can continue: publickeydebug1: Next authentication method: publickeydebug1: Trying private key: /home/sunny/.ssh/id_rsadebug1: Trying private key: /home/sunny/.ssh/id_dsadebug1: Trying private key: /home/sunny/.ssh/id_ecdsadebug1: No more authentication methods to try.Permission denied (publickey).3、可以发现在一下几行出现问题:debug1: Next authentication method: publickey debug1: Trying private key: /home/sunny/.ssh/id_rsa  debug1: Trying private key: /home/sunny/.ssh/id_dsa   debug1: Trying private key: /home/sunny/.ssh/id_ecdsa    debug1: No more authentication methods to try.Permission denied (publickey).4、发现它一直在查找id_rsa、id_dsa、id_ecdsa这三个文件,然后就不尝试其他了;5、我们查看下 ~/.ssh文件夹下的文件:ls ~/.sshgithub  github.pub ...这里没有第4步出现的文件,github是创建ssh-key时输入的名字6、现在我们让~/.ssh文件夹下,还原当初没有改时的名字id_rsacp github id_rsa && cp gitbub.pub id_rsa.pub7、再次尝试连接:ssh -T git@github.comHi xxx ! You've successfully authenticated, but GitHub does not provide shell access.成功。
总结:运用shh -T -v git@github.com查看具体出错信息,再根据信息来调试

转载请注明出处:http://blog.csdn.net/sunnypotter/article/details/18948053

0 0