how to address Git error “the requested upstream branch ‘upstream/master’ does not exist”

git fetch upstream master:master: this work only when you are not on master.
If you are on master, a simple git fetch upstream is enough.

Then you can link your local master to the remote tracking branch upstream/master (which has just been fetched)

git branch -u upstream/master master

Then you can use git pull to update master.
Again, if you are not on master, then yes, git fetch upstream master:master will work.


Luh_ mentions also a typo issue in the refspec: see “git fetch doesn’t fetch all branches”.

Leave a Comment

tech