现象描述
ck@iZwz9caju6kith0s06hhlvZ:~/temp$ ssh -vT git@git.oschina.net
OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /home/ck/.ssh/config
debug1: /home/ck/.ssh/config line 1: Applying options for git.oschina.net
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to git.oschina.net [120.55.226.24] port 22.
debug1: Connection established.
debug1: identity file /home/ck/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/ck/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: Remote protocol version 2.0, remote software version OSChina.NET
debug1: no match: OSChina.NET
debug1: Authenticating to git.oschina.net:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc
debug1: Host 'git.oschina.net' is known and matches the ECDSA host key.
debug1: Found key in /home/ck/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/ck/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to git.oschina.net ([120.55.226.24]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Welcome to Git@OSC, CK星空!
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2648, received 1408 bytes, in 0.2 seconds
Bytes per second: sent 14288.7, received 7597.6
debug1: Exit status 0
这是我的测试代码,显示通过
但是git clone 的时候,依然是
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
公钥配置好了,私钥也添加了,甚至防火墙都关了,为什么还报错呢?
我遇到过的几种情况:
ssh://
(如果没有就加上),比如将ssh://git@git.oschina.net
写成git@git.oschina.net
;