1

I keep my bare repositories on an AFS file server, mounted locally. When I clone them, I do

git clone --no-hardlinks file:///afs/whereever.foo.bar/myrepository.git 

I frequently get the following:

warning: remote HEAD refers to nonexistent ref, unable to checkout.

and no files. This is easily fixed with

git branch master origin/master  
git checkout master  

but I was wondering how to fix it so this isn't necessary.

Thanks,
Liam

Skilldrick
  • 69,215
  • 34
  • 177
  • 229
Liam
  • 1,471
  • 1
  • 15
  • 25
  • You say "frequently", but does that happen all the time, or just sometimes? What if you don't use `--no-hardlinks`? – Greg Hewgill Dec 24 '09 at 22:56
  • Greg, shouldn't `--no-hardlinks` have no effect, anyway, given it's a different filesystem? – Michael Krelin - hacker Dec 24 '09 at 23:01
  • Yes, that's true, but you never know. If it doesn't work when `--no-hardlinks` is used in that situation, maybe there's a bug somewhere. – Greg Hewgill Dec 24 '09 at 23:10
  • I know "frequently" is kind of vague; it's happened several times and I haven't figured out what the common trait is when it happens. I just tried without --no-hardlinks on a particular repository that was giving me this error, and it still gives me the error. – Liam Dec 25 '09 at 02:50

1 Answers1

4

check the /afs/whereever.foo.bar/myrepository.git/HEAD file.

Michael Krelin - hacker
  • 138,757
  • 24
  • 193
  • 173
  • OK I've checked it. It referred to a non-master branch, apparently one that doesn't exist anymore (I recognize the name as one I used at one point, but it's not in there anymore). So I changed that to ref: refs/heads/master and now the repository clones just fine, no error. So my next question is, how did that end up in HEAD instead of refs/heads/master? Thanks for the pointer. – Liam Dec 25 '09 at 02:57
  • It's hard to tell now, there's a plenty of ways you could've set that. – Michael Krelin - hacker Dec 25 '09 at 12:37