Are you encountering the following issue while cloning your own Github git repository?
warning: remote HEAD refers to nonexistent ref, unable to checkout.
(I seriously hope – for your personal sanity – that Google will find this for you ;))
Well, it hit me too, twice, with two different repositories and I don’t have the slightest idea what causes this.
I have a solution, though…
Go into the directory of your already existing repository and create a new branch
git checkout -b foo
Push this new branch to Github. I assume that the remote name is “github”.
git push github foo
Now, go to your project page at Github and change the Default Branch to “foo”. Now switch it back to “master”. Yes, I know. This sounds stupid – but your issue is already solved 😉
The only thing we should do now is some cleanup, i.e. removing the unnecessary “foo” branch:
git push github :foo
git checkout master
git branch -d foo
Stupid… but done.