github - 无法连接到 GitHub API

标签 github jenkins jenkins-plugins github-api

尝试使用 github 时出现错误“无法连接到 GitHub API:org.kohsuke.github.HttpException:服务器返回 HTTP 响应代码:-1,消息:URL 为‘null’:https://github.xxx.com/api/v3/user” Jenkins 中的拉取请求生成器

最佳答案

您可能需要将证书颁发机构证书添加到 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 路径/证书路径相关问题而失败。尝试将您的 CA 证书添加到 key 工具并重新启动 Jenkins 以查看是否有帮助。

Here's the post这帮助我使用 keytool 修改了 java 证书。 (默认的 key 工具密码是“changeit”)

关于github - 无法连接到 GitHub API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44548942/

相关文章:

Windows 10 杀死 EDB Postgres 8080 服务器

安装和升级插件后 Jenkins 作业消失

jenkins - 如何在 Jenkins 声明式管道中使用 Throttle 并发构建

git - 如何将本地机器上的代码推送到主分支中的 GitHub

github - git checkout错误:无法创建目录:权限被拒绝

jenkins - 从 Jenkins 中的参数创建环境变量

jenkins - 如何测试 Jenkins 插件是否安装在 Pipeline DSL (Groovy)

github - 如何删除项目选项卡

git - Github 主分支和主分支的区别?

Jenkins Pipeline Global Library 在工作流之外可用吗? (扩展选择参数)