Cannot verify remote git branch

I am in a local github clone. The following is a list of branches:

$ git branch -a * master online-demo remotes/origin/HEAD -> origin/master remotes/origin/develop remotes/origin/gh-pages remotes/origin/master remotes/origin/online-demo remotes/pateketrueke/develop remotes/pateketrueke/gh-pages remotes/pateketrueke/master 

When I try to check the remote branch, I get an error message:

 $ git checkout develop error: pathspec 'develop' did not match any file(s) known to git. 

I can’t understand where it came from. I guess I’ve done such checks for ages. Maybe I missed something. Anyway, I did git fetch , git fetch origin and git pull , because I am running out of ideas, and there is still the same error.

+6
source share
2 answers

You do not have a local branch named develop . When you run git checkout develop and no local branches are found, git will understand that you want to create a new local branch named develop based on the develop branch in the remote repo, if one exists. In your case, you have 2 such branches origin/develop and pateketrueke/develop , so there is ambiguity.

You can be more explicit in this using the following form:

 git branch develop origin/develop git checkout develop 

or

 git branch develop pateketrueke/develop git checkout develop 

depending on what you want.


They can be abbreviated as:

 git checkout -b develop origin/develop 

or

 git checkout -b develop pateketrueke/develop 
+14
source

You can try checking for full SHA commit

0
source

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


All Articles