最近我的一个GIT服务器镜像迁移了,伴随着ip地址也发生了变化。
经过实践,发现执行一下三步即可解决:
1、进入客户端版本管理后的源码文件夹;
2、执行:
git remote -v
如果目录不对会提示:
fatal: not a git repository (or any of the parent directories): .git
如果正确会提示:
origin git@xxx.xxx.xx.x:/srv/OTS.git (fetch)
origin git@xxx.xxx.xx.x:/srv/OTS.git (push)
3、执行:
git remote set-url origin git@yyy.yyy.yy.y:/srv/OTS.git
执行后会提示一堆信息,只要不出错应该就对的;
4、执行:
git remote show origin
执行后我发现它将服务器的身份信息写到本地的.ssh目录下主机信息文件里了。