git服务器更换地址的问题

git服务器更换地址后,每次git操作必须制定ip的解决方法。

如果新建git仓库重新pull后会提示

fatal: No remote repository specified. Please, specify either a URL or a remote name from which new revisions should be fetched

为了解决这个问题,可以更新原有的.git/config文件内容为,注意下面的ip地址一定要对

 

[remote “origin”]

url = git@192.168.199.110:repositories/xxx.git

fetch = +refs/heads/*:refs/remotes/origin/*

[branch “master”]

remote = origin

merge = refs/heads/master