Я пытаюсь клонировать git-репозиторий, используя JGit.
public static void main(String[] args) throws IOException, InvalidRemoteException, GitAPIException {
String name = "username";
String password = "password";
remotePath = "https://user@stash.gto.intranet.db.com:8081/scm/paragon/paragongit.git";
CredentialsProvider cp = new UsernamePasswordCredentialsProvider(name, password);
File localPath = new File("C:/Users/13 dec/");
if (!localPath.delete()) {
throw new IOException("Could not delete temporary file" + localPath);
}
System.out.println("localPath " + localPath.getAbsolutePath());
System.out.println("Cloning from" + remotePath + "to" + localPath);
Git git = Git.init().setDirectory(localPath).call();
System.out.println("The End");
Git result = Git.cloneRepository().setURI(remotePath).setDirectory(localPath).setCredentialsProvider(cp).call();
System.out.println("The end of program");
}
Но я получаю JGitInternalException
Error->Exception in thread "main" org.eclipse.jgit.api.errors.JGitInternalException: Destination path "13 dec" already exists and is not an empty directory
at org.eclipse.jgit.api.CloneCommand.verifyDirectories(CloneCommand.java:253)
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:189)
at testInAction.main(testInAction.java:39)