Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to connect to GitHub API

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

like image 238
Kalaiyarasan Avatar asked Oct 27 '25 05:10

Kalaiyarasan


2 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")

like image 157
Jeremiah Jordan Avatar answered Oct 30 '25 13:10

Jeremiah Jordan


You can also try installing the skip certificate check plugin, in plugin manager.

like image 31
dgedeon Avatar answered Oct 30 '25 14:10

dgedeon