HOW TO: Configure known_hosts in jgit

shimon360

New Member
Using jgit with gitolite for source control, I have an application that generates certain code on command and which we want to be committed to source control. The goal is to pull with a fast forward, commit the new code, and then push it.I have the following method:\[code\]private void commitToGitRepository(String updateComment, Config config) throws IOException, NoFilepatternException, GitAPIException{ if(git == null) { git = Git.open(new File(config.getDpuCheckoutDir())); } PullCommand pull = git.pull(); pull.call();}\[/code\]This method fails on the \[code\]pull.call()\[/code\] method call, with the following exception:\[code\]com.jcraft.jsch.JSchException: UnknownHostKey: devap01.intellidata.net. RSA key fingerprint is 9d:92:a9:c5:5d:cb:5f:dc:57:ff:38:7e:34:31:fe:75at com.jcraft.jsch.Session.checkHost(Session.java:748)at com.jcraft.jsch.Session.connect(Session.java:319)at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:116)at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:121)at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:248)at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147)at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1104)at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:128)at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:245)at net.intellidata.dpu.controller.schema.EntityMappingController.commitToGitRepository(EntityMappingController.java:149)... (truncated where it meets my code)\[/code\]The way I read this, it seems that it's not finding my known_hosts file in \[code\]user_home/.git\[/code\]. However, I've been searching for an hour and I'm not finding a way to configure JGit to tell JSch where to look for the known_hosts file.Suggestions? I know the entry for the origin is present in my known_hosts file
 
Top