java线程删除文件,线程“main”java.io.jgitinernalexception中的异常:无法删除临时文件c:\users\13 dec...

我正在尝试使用jgit克隆git存储库。

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");

}

但我有个内部异常

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)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值