How to address Git error "requested branch upstream / master does not exist"

I am trying to follow some steps to contribute to the GitHub repository, and one of the steps is not working. Steps here: https://github.com/wdbm/qTox/blob/master/CONTRIBUTING.md#how-to-open-a-pull-request .

I am creating a repository on GitHub.

I am cloning a repository:

git clone https://github.com/<YOUR_USER>/qTox.git

I refer to the local repository directory:

cd qTox

I am adding upstream remote access to be able to fetch upstream from the repository:

git remote add upstream https://github.com/qTox/qTox.git

I am trying to point the local leading branch to the upstream repository:

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

This command does not work with the following error message:

error: the requested upstream branch 'upstream/master' does not exist
hint: 
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint: 
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.

How can I fix this error? I am using Git 2.9.3.

+4
2

git fetch upstream master:master: master. master, git fetch upstream.

master upstream/master ( )

git branch -u upstream/master master

git pull master.
, master, , git fetch upstream master:master .

+8

git branch -u git branch --set-upstream-to=<remote>/<remote branch> branch
-1

Source: https://habr.com/ru/post/1665434/


All Articles