2

I cloned a repository, that has only one remote branch, namely master. After the cloning I get the message, that I'm in a detached HEAD state and git branch also says (no branch).

Git log shows only the initial commit of the repository. After I enter git checkout master, everything is as it should be.

Does anybody know what the problem is?

skappler
  • 722
  • 1
  • 10
  • 26

1 Answers1

1

That would be because HEAD on the remote repository doesn't reference a branch, but a commit.

git-symbolic-ref HEAD refs/heads/master

That would change HEAD on remote (as I mentioned 4 years ago), but supposes you have access to the remote repo (which you don't have).

So jthill's suggestion is still the best:

git clone -b master /url/of/remote/repo
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250