JGit バージョン 3.0.0.201306101825-r で問題が発生しています。ここに私のクローン機能があります:
public static void cloneRepository(String localRepositoryPath, String remoteRepositoryURI, String branch, String username, String password) throws IOException, InvalidRemoteException, GitAPIException {
File workDir = createFolder(localRepositoryPath);
CloneCommand clone = Git.cloneRepository();
clone.setBare(false);
clone.setCloneAllBranches(false);
clone.setBranch(branch);
clone.setDirectory(workDir).setURI(remoteRepositoryURI);
if (StringUtils.isNotEmpty(username)) {
UsernamePasswordCredentialsProvider credentials = new UsernamePasswordCredentialsProvider(username, password);
clone.setCredentialsProvider(credentials);
}
Git git = clone.call();
}
誰でもアクセスできるリポジトリを gerrit から複製しようとしています。「git clone ssh://gerrit.xx.com:29418/project/test」はターミナルから正しく動作しますが、Jgit ではリポジトリのクローンを作成できません。これは私がエラーとして得ているものです:
[INFO] [talledLocalContainer] Caused by: org.eclipse.jgit.errors.TransportException: ssh://gerrit.xx.com:29418/project/test: Auth fail
[INFO] [talledLocalContainer] at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:142) [org.eclipse.jgit-3.0.0.201306101825-r.jar:3.0.0.201306101825-r]
[INFO] [talledLocalContainer] at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:121) [org.eclipse.jgit-3.0.0.201306101825-r.jar:3.0.0.201306101825-r]
[INFO] [talledLocalContainer] at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:248) [org.eclipse.jgit-3.0.0.201306101825-r.jar:3.0.0.201306101825-r]
[INFO] [talledLocalContainer] at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147) [org.eclipse.jgit-3.0.0.201306101825-r.jar:3.0.0.201306101825-r]
[INFO] [talledLocalContainer] at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136) [org.eclipse.jgit-3.0.0.201306101825-r.jar:3.0.0.201306101825-r]
[INFO] [talledLocalContainer] at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122) [org.eclipse.jgit-3.0.0.201306101825-r.jar:3.0.0.201306101825-r]
[INFO] [talledLocalContainer] at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1105) [org.eclipse.jgit-3.0.0.201306101825-r.jar:3.0.0.201306101825-r]
[INFO] [talledLocalContainer] at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:128) [org.eclipse.jgit-3.0.0.201306101825-r.jar:3.0.0.201306101825-r]
[INFO] [talledLocalContainer] ... 55 more
[INFO] [talledLocalContainer] Caused by: com.jcraft.jsch.JSchException: Auth fail
[INFO] [talledLocalContainer] at com.jcraft.jsch.Session.connect(Session.java:491) [jsch-0.1.49.jar:]
[INFO] [talledLocalContainer] at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:116) [org.eclipse.jgit-3.0.0.201306101825-r.jar:3.0.0.201306101825-r]
[INFO] [talledLocalContainer] ... 62 more
[INFO] [talledLocalContainer]
これを修正する方法のアイデアは大歓迎です!