必须在新服务器上设置central存储库,因此我在本地回购系统上创建了一个新的遥控器,并将其推送到该服务器上。
但是现在当我做git pull的时候,它声称我是最新的。这是错误的--它告诉我的是旧的远程分支,而不是新的分支,因为我知道这个分支有新的提交。
如何更改本地分支以跟踪不同的遥控器?
我可以在git配置文件中看到这个,但是我不想把事情搞砸。
[branch "master"]
    remote = oldserver
    merge = refs/heads/master发布于 2011-02-02 19:59:55
使用git v1.8.0或更高版本:
git branch branch_name --set-upstream-to your_new_remote/branch_name或者您可以使用-u交换机
git branch branch_name -u your_new_remote/branch_name使用git v1.7.12或更早版本
git branch --set-upstream branch_name your_new_remote/branch_name发布于 2015-09-12 13:02:41
对我来说,解决办法是:
git remote set-url origin https://some_url/some_repo然后:
git push发布于 2016-07-04 13:32:53
对于最新的git (2.5.5),命令如下:
git branch --set-upstream-to=origin/branch这将更新当前本地分支的远程跟踪分支。
https://stackoverflow.com/questions/4878249
复制相似问题