1. 修改命令
$ git remote origin set-url [url]
2. 先刪后加
$ git remote rm origin
$ git remote add origin [url]
3. 直接修改config文件
修改遠(yuǎn)程倉庫地址后執(zhí)行g(shù)it pull可能回報(bào)錯(cuò):
MacBook-Pro:projects user$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> pj-risk
是因?yàn)楸镜貍}庫與遠(yuǎn)程倉庫的分支未關(guān)聯(lián)浓恳,以master分支為例讲坎,關(guān)聯(lián)master分支的方法:
$ git branch --set-upstream-to=origin/master master
// git branch --set-upstream-to=origin/遠(yuǎn)程分支的名字 本地分支的名字