git | ssh key认证失败问题

为Github账户设置SSH key

在添加完公钥之后, 遇到了下面这种问题:

[root@wdOS dtc2]# git clone [email protected]:xxxxx/dtc2
Cloning into 'Show'...
The authenticity of host 'github.com (192.30.255.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

说是主机密钥验证失败, 可以查看.ssh目录是否缺少了 known_hosts 文件, 而且必须生成 github.com 的ip执行内容. 如下:

[root@iZ94xpmg9boZ .ssh]# ssh [email protected]
The authenticity of host 'github.com (192.30.255.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.

Permission denied (publickey).

然后 .ssh 目录里将是三个文件 . 这样就OK了。

你可能感兴趣的:(git | ssh key认证失败问题)