Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Can't get SimpleHTTPServer working("remote HEAD refers to nonexistent ref" error when trying to use SimpleHttpServer)
Can't get SimpleHTTPServer working [message #1778617] Mon, 18 December 2017 19:38 Go to next message
Dave Musicant is currently offline Dave MusicantFriend
Messages: 15
Registered: May 2016
Junior Member
I've been trying to get org.eclipse.jgit.junit.http.SimpleHttpServer working properly, and I can't seem to get it there.

First I create a repository in /sbasic/remote:

$ cd /sbasic
$ mkdir remote
$ cd remote
$ git init
$ echo hello > file.txt
$ git add file.txt 
$ git commit -am "first commit"
[master (root-commit) 2734fd2] first commit
 1 file changed, 1 insertion(+)
 create mode 100644 file.txt


I then run the following program:

Repository db = new FileRepository("/sbasic/remote");
SimpleHttpServer server = new SimpleHttpServer(db, false);
System.out.println(server.getUri().toString());
server.start();
while(true);


While the above is infinite looping at the end, I go to the command line in a different location (/tmp, say) and enter:

git clone <Uri>

where Uri is the one displayed by the program. Here's a sample session I get:

$ git clone http://127.0.0.1:43511/sbasic/remote
Cloning into 'remote'...
Username for 'http://127.0.0.1:43511': agitter
Password for 'http://agitter@127.0.0.1:43511': letmein
Checking connectivity... done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.


Any ideas what I'm doing wrong here? I can't figure out why I'm getting that remote HEAD error.
Re: Can't get SimpleHTTPServer working [message #1779248 is a reply to message #1778617] Thu, 04 January 2018 12:06 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
You should be serving from a bare repository, find an example in this test class
https://git.eclipse.org/r/plugins/gitiles/egit/egit/+/master/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/clone/SampleTestRepository.java#107

Note that SimpleHttpServer is only meant to be used for testing.
Re: Can't get SimpleHTTPServer working [message #1779341 is a reply to message #1779248] Fri, 05 January 2018 16:03 Go to previous message
Dave Musicant is currently offline Dave MusicantFriend
Messages: 15
Registered: May 2016
Junior Member
Understood. Thanks!
Previous Topic:LFS: Git credentials for xxxx not found
Next Topic:Authentication problem when connecting to Git in TFS after migrating from JGit 3.2 to 4.1
Goto Forum:
  


Current Time: Fri Apr 26 03:17:07 GMT 2024

Powered by FUDForum. Page generated in 0.03311 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top