首页 > 代码库 > 更换仓库地址后,git fetch origin master报错

更换仓库地址后,git fetch origin master报错

1.问题描述:

今天服务器迁移了下git,于是就直接根据拷贝后的git repo创建了远程仓库,本来一切都很顺利。

服务器端执行命令报错。记录下解决过程

2.执行命令报错

$ git fetch origin master
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
50:a9:7a:a2:e6:cc:ae:ea:99:d0:f1:6e:ee:fa:e6:1e.
Please contact your system administrator.
Add correct host key in /c/Users/Administrator/.ssh/known_hosts to get rid of th
is message.
Offending key in /c/Users/Administrator/.ssh/known_hosts:13
RSA host key for 192.168.20.85 has changed and you have requested strict checkin
g.
Host key verification failed.
fatal: Could not read from remote repository.


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

3.解决方法:


vim  /c/Users/Administrator/.ssh/known_hosts



删除 known_hosts里面关于访问ip地址相关的 信息,保存退出即可。


4.重新执行fetch命令


$ git fetch origin master
The authenticity of host ‘192.168.20.85 (192.168.20.85)‘ can‘t be established.
RSA key fingerprint is 50:a9:7a:a2:e6:cc:ae:ea:99:d0:f1:6e:ee:fa:e6:1e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘192.168.20.85‘ (RSA) to the list of known hosts.
git@192.168.20.85‘s password:
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (7/7), done.
From 192.168.20.85:/home/repo/project/
 * branch            master     -> FETCH_HEAD





更换仓库地址后,git fetch origin master报错