首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法通过curl访问github

无法通过curl访问github
EN

Stack Overflow用户
提问于 2012-02-13 16:52:25
回答 2查看 2.9K关注 0票数 3

尝试使用以下命令访问github失败,并显示验证失败错误。我应该怎么做才能解决这个问题?

代码语言:javascript
复制
C:\software\curl-7.23.1-win64-ssl-sspi>curl -i https://api.github.com

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use the -k (or --  insecure) option.
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-02-13 17:05:17

使用msysgit时,我有时必须再次指定http.sslcainfo,以便msysgit正确选取正确的CA证书文件。

代码语言:javascript
复制
 git config --system http.sslcainfo \bin/curl-ca-bundle.crt

(也可以在presented here of the GitHub smart http page中使用)

如果这不起作用:

如以下blog post所示,

  • 尝试指定完整路径:git config --system http.sslcainfo /c/path/to/msysgit/bin/curl-ca-bundle.crt

一个更简单的修复方法是将http.sslcainfo设置为msysGit安装程序的bin文件夹中curl-ca-bundle.crt文件的绝对路径:

代码语言:javascript
复制
$ git config --global http.sslcainfo "/c/Program Files (x86)/Git/bin/curl-ca-bundle.crt"

我选择在--global级别执行此操作,这样以后的msysGit安装就不会覆盖该设置。

"HTTPS github access"中详细介绍了

  • 其他替代方案
票数 2
EN

Stack Overflow用户

发布于 2012-02-13 17:22:22

如果您不想像文本中建议的那样使用--cacert选项(为什么?),可以使用另一个关于-k的建议

代码语言:javascript
复制
>curl -i -k https://api.github.com
HTTP/1.1 302 Found
Server: nginx/1.0.4
Date: Mon, 13 Feb 2012 09:14:24 GMT
Content-Type: text/html;charset=utf-8
Connection: keep-alive
Status: 302 Found
X-RateLimit-Limit: 5000
ETag: "d41d8cd98f00b204e9800998ecf8427e"
Location: http://developer.github.com
X-RateLimit-Remaining: 4999
Content-Length: 0
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9257708

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档