git修改远程仓库地址

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/远程分支的名字 本地分支的名字   
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容