I need to clone a git repo in java. I am using jGit.
The line of code I am using is :
Git clone = Git.cloneRepository().setURI(URIofRepo).setDirectory(localPath).call();
File dirToDelete = new File (path + "/.git");
Exception in thread "main" java.io.IOException: Unable to delete file:
If the open file handle is what prevents the file from being deleted, make sure to close the repository that is returned by
Another approach would be to download an archive of the GitHub repo through its archive link.
Or using JGit to create an archive from your current local repo (see
ArchiveTest.java), and unzip that archive for you to use.