Reputation: 763
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?
Upvotes: 2
Views: 152
Reputation: 1323743
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
Upvotes: 1