Using Keys with JGit to Access a Git Repository Securely
I'm using JGit to access a remote Git repo, and I need to use SSH for it. JGit uses JSch to provide secure access. However, I'm not sure how to set the key file and the knows hosts file for JGit. What I have tried is as follows. Created a custom configuration of the SshSessionFactory , using by subclassing JSchConfigSessionFactory : public class CustomJschConfigSessionFactory extends JschConfigSessionFactory { @Override protected void configure(OpenSshConfig.Host host, Session session) { session.setConfig("StrictHostKeyChecking", "yes"); } } In the class which I access the remote Git repo, did