使用jgit与gitolite源控制,我有一个生成的命令,而我们要致力于源代码控制某些代码的应用程序。 我们的目标是拉了快进,提交新代码,然后将其推。
我有以下方法:
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();
}
这种方法失败的pull.call()
方法调用,但以下情况除外:
com.jcraft.jsch.JSchException: UnknownHostKey: www.somehost.com. RSA key fingerprint is 9d:92:a9:c5:5d:cb:5f:dc:57:ff:38:7e:34:31:fe:75
at 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)
我读了这个问题的方法,似乎它没有找到我的known_hosts文件user_home/.git
。 不过,我一直在寻找一个小时,我没有找到一个方法来配置JGit告诉JSch到哪里寻找known_hosts文件。
建议? 我知道原点的条目存在于我的known_hosts文件