Community
Participate
Working Groups
We have had a couple different people report the message "remote HEAD refers to nonexistent ref, unable to checkout" when cloning an empty repository thinking it was an error. According to this email thread it was something you guys broke when fixing something else awhile back: http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02535.html "Known bug. I think Colby and I accidentally broke this part of the server advertisement a while ago to fix a different bug in our custom JGit servers."
(Added Colby and Shawn to CC, not sure if they're subscribed to project inbox.)
People keep bringing this up over here and someone found a possible fix for you. http://git.eclipse.org/c/jgit/jgit.git/commit/?id=ae1f469 If the two lines mentioned there are removed everything works as expected. So apparently this addition was the cause -> + if (adv.isEmpty()) + adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); //$NON-NLS-1$
pushed fix https://git.eclipse.org/r/#/c/38198/ for review
Created attachment 250370 [details] different result OS X & Windows (when i try clone empty repository via ssh)
In my case, when i try to clone empty repository in windows (empty jgit repo + latest windows git bash(msysgit) + ssh protocol) I got the message like [fatal:could not fetch refs from yobi@localhost:22/1111/P1] and failed to clone. (No repository in my working directory) but, I try to clone empty repository in OS X(mac) (empty jgit repo + git (1.9.3 Apple git-50) + ssh protocol) The result is like LOG ====== LOG ======= OH-MacPro:testPlace oh4851$ git clone ssh://yobi@localhost:22/1111/P1 Cloning into 'P1'... Checking connectivity... done. warning: remote HEAD refers to nonexistent ref, unable to checkout. OH-MacPro:testPlace oh4851$ ls P1
Additionally, I guess that jgit empty repository + msysgit + ssh protocol make problem. 1) jgit + msysgit (for windows user) + ssh protocol -> not work! -> fatal: could not fetch refs for ssh://blah.... -> and, nothing in my working directory. -> clone is fail!! 2) jgit + native git + ssh protocol -> work! -> warning: remote HEAD refers to nonexistent ref, unable to checkout -> but, appear new repository in my working directory. 3) native git server + anything git client(msysgit or git) + ssh protocol -> work!
I also got the same error now, and I am using JGit 4.2, this problem seems still exists.