在 GitHub CLI (gh) 中禁用 SSL 验证

disable SSL verify in GitHub CLI (gh)

我正在处理证书过期的企业 GitHub 服务器,我想使用 GitHub CLI 工具。

gh auth login   

回复:

error validating token: Get "https://github.XXXXXX.com/api/v3/": x509: certificate has expired or is not yet valid: current time 2022-01-04T16:06:33-08:00 is after 2018-06-01T13:55:08Z

我想做一些类似的事情

git config http.sslVerify false

有没有办法在 gh 中做到这一点?

后面是cli/cli issue 1735(对于类似的情况),其中明确指出:

We won't be adding an option to skip certificate verification because that would be insecure and would defeat the point of SSL and certificates being enforced in the first place.

所以,不,gh 无法跳过 SSL 检查。

您需要在该服务器前面添加一个代理(如 caddy),这将反过来将查询代理传递给实际的 GitHub,同时忽略过期的证书服务器。