简体   繁体   中英

Getting AccessDeniedException when cloning repo in Java using JGit

I am programmatically trying to clone a repo using the JGit API. I am using the following piece of code, but when I execute it, I am getting an error.

I have tried all possible solutions which I could find but still I am unable to resolve the problem. Can anyone provide inputs?

File localPath = File.createTempFile("TestGitRepository", "");
Git result = Git.cloneRepository()
                .setURI("https://gitlab.wuintranet.net/fe/wu-content.git")
                .setDirectory(localPath)
                .call(); 

The repo at " https://gitlab.wuintranet.net/fe/wu-content.git " should get cloned but it is throwing this error:

java.nio.file.AccessDeniedException: C:\Program Files\Git\mingw64\etc.probe-e65aa729-82b1-4ff9-8d9b-3a4a7ea3de4a

It looks like a bug they found in last version."5.3.1.201904271842-r" is working for me. you can go back. here is the details

https://github.com/diffplug/spotless/issues/410

I got the same problem under windows during gradle tests. Running the console to from which i start the test in admin mode worked for me. On other operating systems running it with sudo might work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM