Question

I have cloned a remote Git server. but when I want to checkout it with the below code it give me error:

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

Here's output of git branch:

$ git branch -r
  origin/HEAD -> origin/master
  origin/master

$ git branch
  * master

How can I resolve it ?

Was it helpful?

Solution

If you're just trying to checkout the master branch, just run:

git checkout master

Immediately after a clone, your local master branch fully reflects the remote(i.e. origin/master) so you don't need to try and reference the remote when checking out

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top