git修改远程仓库地址

2018-03-06  本文已影响0人  切磋琢磨_FE
1. 修改命令
$ git remote origin set-url [url]
2. 先删后加
$ git remote rm origin
$ git remote add origin [url]

3. 直接修改config文件

修改远程仓库地址后执行git pull可能回报错:

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

是因为本地仓库与远程仓库的分支未关联,以master分支为例,关联master分支的方法:

$ git branch --set-upstream-to=origin/master master   
// git branch --set-upstream-to=origin/远程分支的名字 本地分支的名字   
上一篇 下一篇

猜你喜欢

热点阅读