Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Fwd: JGit Question

including jgit-dev list so that others can benefit from this conversation

some issues I found in your sample:
- it creates an empty repository and adds some changes but doesn't commit them 
  hence the sample repository is empty and there is nothing to clone
- you need to configure a FileResolver in order to tell the daemon from which path
  to serve git repositories

e.g.

...

final FileResolver<DaemonClient> resolver = new FileResolver<DaemonClient>();
resolver.exportDirectory(root);
resolver.setExportAll(true);

final Daemon d;
d = new Daemon(new InetSocketAddress(HOST, PORT));
d.setRepositoryResolver(resolver);

...

- if the client fetches over a network protocol the repository path in the URL corresponds 
  to the relative path to the root directory the file resolver looks at, e.g. 
  - root path for daemon: /root/path/for/daemon/
  - repository path on server : /root/path/for/daemon/test/.git
  -> URL for client : git://host/test/.git

- usually server side repositories are bare repositories, so the usual topology is
  developers or tools changing sources use repository with working tree and
  share changes via a bare server repository

If you need more help with your example I propose you upload it e.g. to GitHub
then it's easier to see what you are working on.

--
Matthias

---------- Forwarded message ----------
From: Nico Henglmüller <mailtonico@xxxxxxxxx>
Date: 2011/10/12
Subject: Re: JGit Question
To: Matthias Sohn <matthias.sohn@xxxxxxxxxxxxxx>

I tried your advice and used the git protocol. I took the localhost IP and the git Port. The Daemon listens on this IP with that port - jgit tells me, that it hasn't found the given remote, or the remote is invalid.

I checked it about 10 - 20 times but I don't find any mistake. I've been using the source for debugging and for understanding how it could work.

The attachments are the classes I've created. Please take a look about it. I want to understand what the developers were thinking when he/she was programming the classes. Then I'll understand how it works.

Please answer this E-Mail!

2011/10/12 Nico Henglmüller <mailtonico@xxxxxxxxx>
If you want to, you can make this discussion public, so everybody could learn from my troubles.

I'll try to use the git:// protocoll. The authentication won't be a problem at all.

2011/10/12 Matthias Sohn <matthias.sohn@xxxxxxxxxxxxxx>
2011/10/12 Nico Henglmüller <mailtonico@xxxxxxxxx>
bon apetit,

a user of my application (node) hasn't got a native Git Client. There is just JGit on the nodes, end these should communicate (fetch, push, etc.) with each other (without native git). Unfortunately, the Ssh Server doesn't do the trick. 

My main question is: Whats the easiest way to fetch a remote repo using JGit (no native git at all) on both nodes (local and remote)?

I think you are talking about a scenario like this:

Local: JGit implementation (e.g. EGit)
Remote: Native Git (e.g. github or other native git node)

I'm talking about:

Local: JGit implementation
Remote: JGit implementation

Instead of EGit there would be my application.

Thanks for your help so far - und dass Sie es bisher so gut ausgehalten haben mit meinen lästigen Fragen. But I really want to implement JGit and getting involved.


any reason why this is a private discussion and not on the jgit-dev list ?
Maybe other users can also learn from our discussion...

- I think the easiest protocol is file:// usually this is only available in an intranet and it doesn't provide
authentication so you can't control easily who can use it. 
- Second one is git protocol this would require
to run JGit daemon (find that following my last mail), again this doesn't have authentication. 
- Third one is to subclass GitServlet and run that in a web container. 
- Most complex option is probably ssh server as you need to care for host keys and the like
and most developers are more familiar how to create a Servlet compared to running a sshd.

--
Matthias

 
Please answer this E-Mail !

2011/10/12 Nico Henglmüller <mailtonico@xxxxxxxxx>
I think a ssh server, like gerrit uses it, would be the trick to establish the communication. My application isn't as big as gerrit and it's based on J2SE not J2EE. But the idea to use a java implementation of ssh is great. I've to take a look, how i can serve the ssh requests (git fetch, etc.) to jgit.


2011/10/12 Matthias Sohn <matthias.sohn@xxxxxxxxxxxxxx>
2011/10/12 Nico Henglmüller <mailtonico@xxxxxxxxx>
Hi Mathias,

as you already said, the jgit to jgit communication was implemented by gerrit. So my Question is, how can I establish the connection and communication between two jgit nodes? I looked for a solution at the gerrit code, but can't find anything. Do you have a code example or documented code?

depends on the transport protocol. Gerrit runs a subclass of JGit's GitServlet 
(in org.eclipse.jgit.http.server) and a ssh daemon to serve git transport over 
HTTP/HTTPS and SSH protocol. Look at class ProjectServlet in gerrit-httpd 
for the HTTP daemon and at class SshDaemon in gerrit-sshd for the SSH daemon.

Gerrit gets called from other JGit's e.g. embedded in a developer's EGit inside 
his Eclipse workbench over these two communication endpoints. The usual 
operations are clone, fetch, push, ls-remote and friends. Gerrit doesn't directly 
serve the git:// protocol (would be possible since JGit supports it, but AFAIK this 
just wasn't integrated into Gerrit), instead it relies on the native git daemon. 
If you want to run JGit's git daemon look at the class Daemon in org.eclipse.jgit.pgm.
 
--
Matthias



--
Kind Regards,
Nico Henglmüller



Legal Disclaimer: The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message




--
Kind Regards,
Nico Henglmüller


Legal Disclaimer: The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message




--
Matthias



--
Kind Regards,
Nico Henglmüller




--
Kind Regards,
Nico Henglmüller


Legal Disclaimer: The information contained in this message may be privileged and confidential. It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message




--
Matthias

Attachment: ClientMain.java
Description: Binary data

Attachment: JGitExperiment.java
Description: Binary data

Attachment: ServerMain.java
Description: Binary data


Back to the top