关于本地Git仓库远程push至GitHub仓库

时间:2021-07-20 05:03:00

昨天在学习Git,远程push至GitHub仓库是验证死活不通过

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)?
Host key verification failed.
fatal: Could not read from remote repository.

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

一直包这个错误,仔细看了公钥,没有问题啊,后面经过本人的不懈努力去百度,发现缺少了known_hosts这个文件,解决方法如下。


步骤如下

ssh git@github.com    /*执行这段命令*/

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)? yes /*在这里键入yes*/

Warning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi LifeIsAKnife! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

这样再去看.ssh文件夹下就有known_hosts这个文件啦,接下来就可以远程push至GitHub仓库啦。