This paper mainly solves a problem
git clone has a public key permission issue. The symptoms are as follows:
Casondemacbook-pro:devops cason$ git clone [email protected]:360yyou/yyou.git
Cloning into ' yyou ' ...
Permission denied (PublicKey).
Fatal:could not read from remote repository.
Sure you have the correct access rights
and the repository exists.
To debug this problem, you can use the SSH-VT parameter, such as the following:
SSH-VT [email protected]
OPENSSH_6.2P2, Osslshim 0.9.8r 8 DEC 2011
Debug1:reading Configuration Data/etc/ssh_config
DEBUG1:/etc/ssh_config line 20:applying options for *
DEBUG1:/etc/ssh_config line 102:applying options for *
Debug1:connecting to github.com [192.30.252.130] Port 22.
Debug1:connection established.
Debug1:identity File/users/cason/.ssh/id_rsa type-1
Debug1:identity File/users/cason/.ssh/id_rsa-cert type-1
Debug1:identity FILE/USERS/CASON/.SSH/ID_DSA type-1
Debug1:identity File/users/cason/.ssh/id_dsa-cert type-1
debug1:enabling compatibility Mode for Protocol 2.0
Debug1:local Version string ssh-2.0-openssh_6.2
Debug1:remote Protocol version 2.0, Remote software version libssh-0.7.0
Debug1:no match:libssh-0.7.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_kexdh_init
Debug1:expecting ssh2_msg_kexdh_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/users/cason/.ssh/known_hosts:2
Warning:permanently added the RSA host key for IP address ' 192.30.252.130 ' to the list of known hosts.
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:trying private key:/users/cason/.ssh/id_rsa
Debug1:trying private key:/USERS/CASON/.SSH/ID_DSA
Debug1:no more authentication methods to try.
Permission denied (PublicKey).
Solution:
The first thing to do is to set up your system's public, private key (Ssh-keygen)
Method:
CD ~/.ssh && Ssh-keygen
Second, put the public key on GitHub and you can do it through the Clipboard.
On OSX run:cat id_rsa.pub | Pbcopy
On Linux run:cat id_rsa.pub | Xclip
Finally, set up your git
git config--global user.name "Bob"
git config--global user.email [email protected]
git clone [email protected]: Xxx.git Permission denied (PublicKey) problem Solving method