Working with a remote repository in JGit
git, java, jgit
Solution
In order to access the history of a Git repository you need to clone it first. The clone may be bare if you are not interested in the working dir, but a clone is required.
Git allows to create a shallow clone that includes only the history up to a specified depth, however JGit still lacks support for shallow clones: https://bugs.eclipse.org/bugs/show_bug.cgi?id=475615
Problem
I am working on a project where we have to use JGit. I have a problem when I try to work with a remote git repository (the git that is not cloned in my local device) I receive the following exception: No HEAD exists and no explicit starting revision was specified If I clone the repository it works well, but repositories are quite big and I cannot clone it because of project requirements. Is there a way how to work with remote repositories? I do only simple read operations.