JGit : connect to distant repository

jgit, remote-access

Solution

Currently, JGit 2.0.0-SNAPSHOT does only offer

org.eclipse.jgit.storage.file.FileRepository
org.eclipse.jgit.storage.dfs.InMemoryRepository

concrete `Repository` classes, meaning that since `org.eclipse.jgit.api.Git` takes a `Repository`, it is not possible to work remotely. Since Git by itself is not designed to operate remotely in the way I think you mean, I doubt we will see such a feature any time soon.

MORE ON THAT:

Consequently, you will need to clone locally. You do that by issuing

    Git.cloneRepository()
       .setURI(myRemoteURIString)
       .setDirectory(new File(myLocalPathString))
       .call();

However, for reasons of consistency in Git you should clone a bare repository only, so a non-bare repository in a remote location, while not technically, is practically inaccessible.

Problem

I searched through Google, forums and JGit user guide but couldn't find how to connect to a distant repository with the API. Anyone has an example or just an idea on how to do that? Thanks for your help.

Original source

Related problems