我们收到错误“无法连接到GitHub API:org.kohsuke.github.HttpException:服务器返回HTTP响应代码:-1,消息:'null'用于URL:https://github.xxx.com/api/v3/user”当尝试在jenkins中使用github pull request builder时
您可能需要将证书颁发机构证书添加到java keytool。
如果你查看你的jenkins日志并找到这样的东西:
org.kohsuke.github.HttpException: Server returned HTTP response code: -1, message: 'null' for URL: https://github.xxx.com/api/v3/user
向下滚动,看看是否有这样的行:
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
此错误表示SSL握手失败,其中包含有关PKIX路径/ certpath的信息。尝试将您的CA Cert添加到keytool并重新启动Jenkins以查看是否有帮助。
Here's the post帮我修改了keytool的java证书。 (默认的keytool密码是“changeit”)
看来你的java cacerts没有正确的git URL证书。你可以尝试以下步骤。
第1步:获取https://www.google.com的根证书
而已!你有根证书!
第2步:将证书安装到您的java cacerts
请确认您已声明系统变量JAVA_HOME,并且您将仅在该jre cacerts上执行这些步骤!
第3步:重新启动jenkins
你现在不应该得到ssl握手问题。