0

Lets start by saying my code works. I can click a batch file that runs a jar file, that downloads some code from GIT.

Git gitRepo = Git.cloneRepository().setURI( remoteProjectPath )
.setDirectory(new File(destination))
.setCredentialsProvider( new UsernamePasswordCredentialsProvider( repoUser, repoPassword ) )
.setBranch(branch)
.setNoCheckout(true)
.call();

In windows, in my user profile folder i have a .gitconfig file that contains:

[http]
sslverify = false

when I double click the batch file, it works. But, this is part of an automated process. i need windows task scheduler to execute the batch file at midnight. (time is not important, other than it's when i'm not at work.) But i can open the task scheduler and click on the task and click 'run' and it fails with the sslverify flag.

"Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"

it appears to me that the .gitconfig is only used when I (manually) execute the process. Is there a way to figure out if JGit is attempting to read from a different dir when started by task scheduler? Or is there another way to make JGit use sslverify=false for a sparse checkout using CloneCommand?

Thanks,

ChrisThompson
  • 1,998
  • 12
  • 17
  • JGit's CloneCommand can't skip SSL verification, see here: http://stackoverflow.com/questions/33998477/set-ssl-verification-off-for-jgit-clone-command – Rüdiger Herrmann Apr 26 '17 at 19:34

1 Answers1

0

I fought this for so long, and finally find an answer shorting after I post the question. In a reference to EGit I found: How to change "Location" for "User Settings"

But it worked for me. I went to the system environment variables and created a system variable 'HOME' and set it to a directory containing the .gitconfig file I needed. and now the process works even when kicked off from windows task scheduler.

ChrisThompson
  • 1,998
  • 12
  • 17