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

本文介绍了如何解决在使用Git向GitHub远程仓库推送时遇到的主机密钥验证失败问题。通过执行特定SSH命令并确认信任该主机,最终成功创建了known_hosts文件,实现了远程推送。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

昨天在学习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仓库啦。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值