Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法通过curl访问github_Curl_Github - Fatal编程技术网

无法通过curl访问github

无法通过curl访问github,curl,github,Curl,Github,尝试使用以下命令访问github失败,出现验证失败错误。我该怎么做才能解决这个问题 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:ce

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

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.

有了msysgit,我有时不得不再次指定
http.sslcainfo
,以便msysgit正确获取正确的CA证书文件

 git config --system http.sslcainfo \bin/curl-ca-bundle.crt
(也包括在中)
如果这不起作用:

  • 尝试指定完整路径:
    git config--system http.sslcainfo/c/path/to/msysgit/bin/curl ca bundle.crt
    ,如下所示:
一个更简单的修复方法是将
http.sslcainfo
设置为msysGit安装的bin文件夹中
curl ca bundle.crt
文件的绝对路径:

我选择在
--global
级别执行此操作,这样设置就不会被将来的msysGit安装覆盖

  • 其他备选方案详见“”
如果您不想使用--cacert选项(为什么?),请使用另一个关于-k的建议

>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

注意:此选项禁用SSL证书验证--cacert是首选的方式。使用cURL访问GitHUb会使SSL有些冗余。使用
-Lk
标志也可以跟随任何重定向。
>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