|Re: [jgit-dev] Connect to repo using SSH|
The JSSH library used by JGit picks up SSH keys from ~/.ssh/ by default, IIRC. If you need more control you can fully configure this process with a TransportConfigCallback:
For instance, if a client needs to replace the SshSessionFactorys on any SSHTransport used, they can set the TransportConfigCallback on the JGit API command - once the transport has been created by the command, the callback will be invoked and passed the transport instance, which the client can then inspect and configure as necessary.
Here's an example in Agit of using the callback to do custom SSH challenge generation - this may be slightly more involved than what you need, you can probably get away with one of the default JSSH Identity implementations:https://github.com/rtyley/agit/blob/35c48634/agit/src/main/java/com/madgag/agit/git/AgitTransportConfig.java#L44-L46
Using jgit API, how do I connect to a repository using a SSH key and passphrase?
jgit-dev mailing list
Back to the top