To build git code management warehouse, ssh-key does not have permission, prompting’ Permission denied (publickey).’

  git, question
The key's randomart image is:
 +---[RSA 2048]----+
 |    .+Bo+oo      |
 |     +o*oo       |
 |    o +*o      . |
 |     oo...   .+.+|
 |       .S.  +oo=+|
 |        o  E .o++|
 |         . o.o.++|
 |          o *o*. |
 |           o *o  |
 DDYSdeMacBook-Pro:.ssh root# ls
 DDYSdeMacBook-Pro:.ssh root# pbcopy < ~/.ssh/
 DDYSdeMacBook-Pro:.ssh root# ssh -T
 ssh: connect to host port 22: Connection refused
 DDYSdeMacBook-Pro:.ssh root# ssh -T
 The authenticity of host ' (' can't be established.
 ECDSA key fingerprint is SHA256:+DTw/FsJ0q+UOCsohhrUKCVhpVJuaYSITVpcZ8+aH3o.
 Are you sure you want to continue connecting (yes/no)?  yes
 Warning: Permanently added ',' (ECDSA) to the list of known hosts.
 Permission denied (publickey).

According to Daniel’s technology blog routine, step by step, the result still failed. I could do it from github, and then the architect of git also said it was helpless, because they were all windows desktop computers, but mine was Apple. …

After searching a lot of information, I said that if you re-create the key or restart it, it will still fail.
I’ve come to post to ask Youmuyou, a big boss who has encountered similar situations.

Try the profile

Add the following code snippet to the new. ssh/config file:

Host Name or IP
 PreferredAuthentications publickey
 Identity file ~/.ssh/coding _ RSA//public key repository for non-default addresses generated

For example, my Github configuration

# Github
 PreferredAuthentications publickey
 IdentityFile ~/.ssh/id_rsa