./.ssh/known_hosts文件导致提交代码到远程仓库报错的解决方案

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lovefengruoqing/article/details/79080774

刚才在提交本地代码到远程仓库的时候,突然提交不了,还以为是服务器的问题,去github上去看了下,发现能够正常连接,没什么问题。

贴一下我的报错代码:

$ git push web
Everything up-to-date
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:TngedZvoVx6AE97KA6TI99Ap/0EcYGmvvTby9e8S6BQ.
Please contact your system administrator.
Add correct host key in /c/Users/root/.ssh/known_hosts to get rid of this message.
Offending RSA key in /c/Users/root/.ssh/known_hosts:3
RSA host key for git.coding.net has changed and you have requested strict checking.
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”删除掉或者担心删除了会有风险,改个名字,然后在重新提交的时候,就能正确提交了。

//我用windows,文件路径在这里:
C:\Users\root\.ssh

//然后将known_hosts删掉或者改成known_hosts.bak

然后再次push的时候,就提示你是不是要连接,你输入YES就OK了。

猜你喜欢

转载自blog.csdn.net/lovefengruoqing/article/details/79080774