We are getting an error "Unable to connect to GitHub API: org.kohsuke.github.HttpException: Server returned HTTP response code: -1, message: 'null' for URL: https://github.xxx.com/api/v3/user" when trying to use github pull request builder in jenkins
-
Hard to say, but have you checked credentials that you are using to access that repository? – sshepel Nov 10 '17 at 19:21
3 Answers
You may need to add your Certificate Authority cert to the java keytool.
If you look in your jenkins log and find something like this:
org.kohsuke.github.HttpException: Server returned HTTP response code: -1, message: 'null' for URL: https://github.xxx.com/api/v3/user
Scroll down and see if there is a line like this:
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
This error is saying that the SSL handshake failed with something about the PKIX path/certpath. Try adding your CA Cert to the keytool and restarting Jenkins to see if that helps.
Here's the post that helped me modify the java certs with the keytool. (the default keytool password is "changeit")

- 11
- 1
it seems your java cacerts is not having correct certificate for your git URL. you may try following steps.
Step 1 : Get root certificate of https://www.google.com
- Open https://www.google.com in a chrome browser.
- Select Inspect from context menu(right clicking on page) and navigate to security tab
- Click on view certificates
- Click on top most certificate on hierarchy and confirm it is tailed with Root CA phrase.
- drag and drop that image which you saw written certificate on desktop.
Thats it! you got your root certificate!
Step 2 : install certificate to your java cacerts
please verify you have system variable JAVA_HOME declared and you will perform these steps on that jre cacerts only!
- Navigate to cacerts by JAVA_HOME/jre/lib/security/cacerts
- Download and install keytool explorer it is available for all platforms
- open cacerts in that tool and import cetificate by "import trusted certificate" button.
- Save your changes (you may come across issue if it is mac and you do not have write access!)
Step 3 : Restart jenkins
You should not get ssl handshake problem now onwards.

- 1,307
- 2
- 16
- 35