This seems like a popular error for different causes.
I've got a simple bare git repo called "kiflea.git", I clone it like this:
git clone git://kipdola.be/kiflea.git
Then git tells me: warning: remote HEAD refers to nonexistent ref, unable to checkout.
And yes, there are no versioned files in the map, except for the .git directory.
Anyway, the only thing I need to do is:
cd kiflea
git checkout master
And it works, all the files are there.
But I thought cloning a repo automatically checks out the master, so what is going on exactly, and how do I fix it?
I have noticed that, after I do the git checkout master
bit, this gets added to my local .git config file:
[branch "master"]
remote = origin
merge = refs/heads/master
It's probably interesting to know that this git repository used to be an svn repository in a distant past.
Ps: when browsing the bare repository using gitweb, there clearly is a master
branch there: http://kipdola.be/gitweb/?p=kiflea.git;a=summary
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…