項(xiàng)目中會(huì)因?yàn)楹芏嗲闆r需要更改遠(yuǎn)程倉(cāng)庫(kù)地址,比如項(xiàng)目遷移或者遠(yuǎn)程倉(cāng)庫(kù)換了新的ip等。未重置之前與遠(yuǎn)程的操作會(huì)出現(xiàn)如下的錯(cuò)誤提示
fatal: unable to access 'http://39.118.252.142/fe/test.git/': Failed to connect to /39.118.252.142 port 80: Timed
out
舊地址:http://39.118.252.142/fe/test.git
新地址:http://git.ouyang.cn/fe/test.git
1、通過命令直接重置
> git remote set-url origin http://git.ouyang.cn/fe/test.git
2、修改配置文件
> cd test/.git
> vim config
[core]
repositoryformatversion = 0
filemode = true
logallrefupdates = true
precomposeunicode = true
[remote "origin"]
# 在這兒修改成新的倉(cāng)庫(kù)地址
url = http://git.ouyang.cn/fe/test.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
3、先刪除后添加
> git remote rm origin
> git remote add origin http://git.ouyang.cn/fe/test.git