问题
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