# JGit

## Prerequisites

JGit 6.0 requires Java 11 to run. Previous versions required a minimum of Java 1.8.

Please note that memory management in Java is different between Java versions; there are new garbage collection strategies. One corporate user of JGit who has been using it for a long time running on Java 11 reported that switching from Java 1.8 to Java 11 and using the new G1GC default garbage collector improved stability but might require about 10% more memory.

## API changes

- `CommitCommand.setCredentialsProvider()` is now fluent, returning the CommitCommand itself to allow chaining setters.

For the full list of API changes, see the automated API comparison report linked on the JGit download page.

## SSH Agent Support

JGit 6.0 comes with a new bundle `org.eclipse.jgit.ssh.apache.agent`, which provides support for communicating with an SSH agent:

- On Windows, it supports detecting Pageant, the SSH agent of PuTTY, and communicating with it through its shared memory mechanism.
- On Unix (Linux, BSD, OS X), it supports communicating with an SSH agent via the usual Unix domain socket mechanism. The Unix domain socket file is given via environment variable `SSH_AUTH_SOCK`.

The bundle publishes a service for `java.util.ServiceLoader`; the main SSH support in `org.eclipse.jgit.ssh.apache` uses the `ServiceLoader` to find the service implementation. If none is found, SSH agent support is not available.

Using the new bundle `org.eclipse.jgit.ssh.apache.agent` is completely optional; and JGit users are free to provide their own implementation instead in a third-party bundle. The bundle just has to publish an `org.eclipse.jgit.transport.sshd.agent.ConnectorFactory` implementation as service. (Ensure that the classpath is set up such that the `ServiceLoader` can find the custom implementation from within bundle `org.eclipse.jgit.ssh.apache`. In an OSGi environment, this is most easily achieved by making the bundle an OSGi fragment with that bundle as host.)

The implementation uses JNA for low-level system operations.

### Limitations

Some directives in the `~/.ssh/config` file are not handled yet:

- `IdentityAgent`
- `AddKeysToAgent`
- `SecurityKeyProvider`

Support for these is planned for a future version as it needs upstream changes in the Apache MINA sshd library used by JGit for SSH communication.

Integration with a native keychain (the `UseKeychain` directive on Mac) is not supported.

Agent forwarding is not supported. Use the `ProxyJump` directive in `~/.ssh/config` instead.