SSH密钥不适用于全新的Linux安装

时间:2015-05-01 06:55:33

标签: git ubuntu ssh linuxmint

我最近重新安装了我的操作系统(Mint 17.1)并希望使用我的ssh键连接到git。到目前为止,我已经在许多地方使用过这个键而没有任何问题。关于这个问题有很多答案,但到目前为止他们都没有帮助我。

.ssh目录具有0700权限

所以我得到的输出是:

ssh -vT git@github.com
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/herod/.ssh/config
debug1: /home/herod/.ssh/config line 1: Applying options for *
debug1: /home/herod/.ssh/config line 9: Applying options for github.com
debug1: /home/herod/.ssh/config line 14: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [192.30.252.128] port 22.
debug1: Connection established.
debug1: identity file /home/herod/.ssh/xxxx/id_rsa.pub type 1
debug1: identity file /home/herod/.ssh/xxxx/id_rsa.pub-cert type -1
debug1: identity file /home/herod/.ssh/xxxx2222/id_rsa.pub type 1
debug1: identity file /home/herod/.ssh/xxxx2222/id_rsa.pub-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: Remote protocol version 2.0, remote software version libssh-0.6.0
debug1: no match: libssh-0.6.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/herod/.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: /home/herod/.ssh/xxxx/id_rsa.pub
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: key_parse_private2: missing begin marker
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/herod/.ssh/xxxx/id_rsa.pub': 
debug1: key_parse_private2: missing begin marker
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>

1 个答案:

答案 0 :(得分:0)

这对我有用(答案来自here):

  

“对我来说,因为密钥本身是加密的,所以我遵循以下内容   步骤进行:

     

启动ssh-agent:

     

$ ssh-agent bash

     

将标准身份密钥添加到密钥管理器:

     

$ ssh-add

     

如果您想添加其他密钥,请:

     

$ ssh-add / location / of / key

     

要随时检查当前加载的密钥列表:

     

$ ssh-add -l可以从此link

获取更多详细信息

作为@Kenster评论的附加内容以及添加密钥时此处的解决方案,您必须添加私钥

  

$ ssh-add / location / of / key(ex ssh-add .ssh / folder / id_rsa)

而不是

  

$ ssh-add /location/of/key.pub(ex ssh-add .ssh / folder / id_rsa.pub)