0
我正在使用JGit使用下面的代码克隆远程git仓库。JGit删除git存储库
localRepo = new FileRepository(path+"/.git");
git = new Git(localRepo);
clone = Git.cloneRepository().setURI(url).setBranch(branch)
.setDirectory(new File(path)).call();
clone.getRepository().close();
clone.close();
git.getRepository().close();
克隆下一个回购之后,因为我需要删除目录,所以我使用下面的代码。
File tempGitDirectory;
try {
tempGitDirectory = new File(dirPath);
if(tempGitDirectory.exists()){
FileUtils.deleteDirectory(tempGitDirectory);
}
} catch (IOException e) {
}
在我的Mac上,一切工作正常。但在尝试使用redhat linux时,我无法完全删除回购站。遇到下面的错误。
rm: cannot remove `git//TestGit/.nfs000000000011f6d40000032a': Device or resource busy
任何线索?
Thanks @VonC。我为克隆的回购打开了一个pom.xml阅读器。 FileReader未关闭。现在工作正常。感谢你的帮助。 – Upen
@非常棒!我已将您的评论纳入答案中,以获得更多的知名度。 – VonC