Bug 442493 - remote HEAD refers to nonexistent ref, unable to checkout
Summary: remote HEAD refers to nonexistent ref, unable to checkout
Status: NEW
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Target Milestone: 3.5   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-25 09:59 EDT by Karen Ramirez CLA
Modified: 2016-04-15 03:04 EDT (History)
8 users (show)

See Also:


Attachments
different result OS X & Windows (when i try clone empty repository via ssh) (665 bytes, text/plain)
2015-01-29 22:40 EST, hyeok oh CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karen Ramirez CLA 2014-08-25 09:59:16 EDT
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."
Comment 1 Robin Stocker CLA 2014-08-25 10:10:36 EDT
(Added Colby and Shawn to CC, not sure if they're subscribed to project inbox.)
Comment 2 Karen Ramirez CLA 2014-12-11 17:02:51 EST
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$
Comment 3 Matthias Sohn CLA 2014-12-13 19:36:16 EST
pushed fix https://git.eclipse.org/r/#/c/38198/ for review
Comment 4 hyeok oh CLA 2015-01-29 22:40:09 EST
Created attachment 250370 [details]
different result OS X & Windows (when i try clone empty repository via ssh)
Comment 5 hyeok oh CLA 2015-01-29 22:43:03 EST
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
Comment 6 hyeok oh CLA 2015-01-30 03:45:59 EST
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!
Comment 7 Yang Yang CLA 2016-04-15 03:04:09 EDT
I also got the same error now, and I am using JGit 4.2, this problem seems still exists.