[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