title: How do you set the configuration for jschconfigsessionfactory for jgit so that pull and push work?
body: <p>I am trying to do a git pull/push using jgit's api with the following code</p>
  
  <pre><code>org.eclipse.jgit.api.Git.open(theRepoFile).pull().call()
  </code></pre>
  
  <p>but I am getting exceptions</p>
  
  <pre><code>JSchException Auth fail
  com.jcraft.jsch.Session.connect (Session.java:461)
  org.eclipse.jgit.transport.JschConfigSessionFactory.getSession (JschConfigSessionFactory.java:116)
  org.eclipse.jgit.transport.SshTransport.getSession (SshTransport.java:121)
  org.eclipse.jgit.transport.TransportGitSsh$SshPushConnection.&lt;init&gt; (TransportGitSsh.java:306)
  org.eclipse.jgit.transport.TransportGitSsh.openPush (TransportGitSsh.java:152)
  org.eclipse.jgit.transport.PushProcess.execute (PushProcess.java:130)
  org.eclipse.jgit.transport.Transport.push (Transport.java:1127)
  org.eclipse.jgit.api.PushCommand.call (PushCommand.java:153)
  </code></pre>
  
  <p>Even though using cgit pull and pushing works.</p>
  
  <p>I tried checking SO for example code</p>
  
  <p><a href="https://stackoverflow.com/questions/7951307/java-git-client-using-jgit">Java git client using jgit</a></p>
  
  <p>but the above question does not provide a complete coded example of what is necessary to do a git pull with a remote repo that is normally authenticated via ssh keys. There should be a way to get the credential information from <code>~/.ssh/</code> or the windows equivalent.</p>