warning: Not setting branch master as its own upstream

房东的猫 提交于 2021-02-08 10:30:03

问题


I am trying to set git branch upstream but getting below warning.

Command

git checkout master
git branch --set-upstream-to master

warning: Not setting branch master as its own upstream.

How can I solve it?

Does that mean it already being tracing correct remote branch master?


回答1:


That should be:

 git branch --set-upstream-to origin/master

But if origin/master is there, the checkout should have tracked it already.

If <branch> is not found but there does exist a tracking branch in exactly one remote (call it <remote>) with a matching name and --no-guess is not specified, treat as equivalent to:

$ git checkout -b <branch> --track <remote>/<branch>

With Git 2.23+, you would use git switch master instead of checkout, as I mentioned here.



来源:https://stackoverflow.com/questions/60700767/warning-not-setting-branch-master-as-its-own-upstream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!