SSH登陆异常(远程git仓库修改ssh链接主机ip致使ssh链接异常)的解决方案

今天在向我腾讯工蜂git管理仓库推送代码时出现下面的错误:git

$ git push
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:O/rHOxiTfD6BGBM8iwioUtqx8qHDxxd3uYn1hee4/Rc.
Please contact your system administrator.
Add correct host key in /c/Users/Administrator/.ssh/known_hosts to get rid of this message.
Offending RSA key in /c/Users/Administrator/.ssh/known_hosts:7
RSA host key for git.code.tencent.com 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. 复制代码
  • 在遇到这个问题时,个人第一感受是腾讯工蜂7月20号的更新致使我本地ssh链接出现了异常。 
  • 凭着本身半桶水的英文理解,我对这段英文的解读是,ssh会把你每一个你访问过计算机的公钥(public key)都记录在~/.ssh/known_hosts。当下次访问相同计算机时,OpenSSH会核对公钥。若是公钥不一样,OpenSSH会发出警告, 避免你受到DNS Hijack之类的攻击。咱们经过ssh登陆过一次远程仓库后就会把ssh信息记录在本地的~/.ssh/known_hsots文件中,切换该系统后再用ssh访问这台主机就会出现冲突警告,须要手动删除修改known_hsots里面的内容。
  • 所以我在系统盘找到.ssh文件夹下的known_hosts 文件删掉对应的冲突连接主机记录

  • 删除完再推送本地仓库带代码,效果以下:bash


  • 至此,git从新与腾讯工蜂系统创建了一条新的主机链接记录,能够从新提交代码啦!ssh


写在最后:ui

   第一次把本身遇到的问题写出来,可能存在少量纰漏。后续会有更多的总结分享,欢迎各位大牛指正!this

相关文章
相关标签/搜索