Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] git clone via secured connection

Thanks for your reply.
On 01.03.2013 04:18, Shawn Pearce wrote:
And my code:
public class CustomJschConfigSessionFactory extends JschConfigSessionFactory
{
   @Override
   protected void configure(OpenSshConfig.Host host, Session session) {
       session.setConfig("StrictHostKeyChecking", "no");
   }
}

The settings and clonging part:
CloneCommand clone = git.cloneRepository();
      try {
          CustomJschConfigSessionFactory jschConfigSessionFactory = new
CustomJschConfigSessionFactory();
          JSch jsch = new JSch();
          jsch.addIdentity(pathToKey);
          SshSessionFactory.setInstance(jschConfigSessionFactory);
This key is not connected to the objects JGit is using... which is
probably why you are getting an authentication failure. Don't you need
to add the key inside of the jschConfigSessionFactory?
I can't find any possibility in the javadoc of jsch, it's only possible to configure the session. But the session doesn't hold the keys, the are managed by the Jsch object. You are right, Iam adding the keys to an unrelated instance of Jsch. I only have to figure out how to do this with the jschConfigSessionFactory, should get some sleep first.
Maybe someone has an idea how this can be properbly handled?

Thanks in advance,
Flask



Back to the top