无法通过curl访问github [英] Unable to access github via curl

查看:571
本文介绍了无法通过curl访问github的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用以下命令访问github失败,验证失败错误。我应该如何处理此问题

  C:\software\curl-7.23.1-win64-ssl-sspi> ; curl -i https://api.github.com 

curl:(60)SSL证书问题,请验证CA证书是否正确。详细信息:
错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败
更多详细信息:http://curl.haxx.se/docs/sslcerts.html

curl默认情况下使用证书颁发机构(CA)公钥(CA证书)的捆绑
执行SSL证书验证。如果默认的
bundle文件不足,您可以使用--cacert选项指定一个备用文件

如果此HTTPS服务器使用由
表示的CA签署的证书,则证书验证可能失败,原因是证书的
问题(可能已过期,或者名称可能
与网址中的域名不匹配)。
如果要禁用curl对证书的验证,请使用-k(或 - 不安全)选项。


解决方案

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

  git config --system http.sslcainfo \bin / curl-ca-bundle.crt 

此处显示,并在 注释

如果此不工作:






一个更容易的解决方法是将 http.sslcainfo 设置为的绝对路径curl-ca-bundle.crt <
<$ block
$ b

  $ git config  -  code> code>全局http.sslcainfo/ c /程序文件(x86)/Git/bin/curl-ca-bundle.crt




我选择在 - global 级别执行此操作,因此此设置不会被未来的msysGit安装覆盖。 / p>




Trying to access github using the following command fails with the verification failed error. What should I do get past this issue

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.

解决方案

With msysgit, I sometime have to specify again http.sslcainfo for msysgit to correctly pick up the right CA cert file.

 git config --system http.sslcainfo \bin/curl-ca-bundle.crt

(Also presented here and in the comments of the GitHub smart http page)
If this doesn't work:

  • try to specify the full path: git config --system http.sslcainfo /c/path/to/msysgit/bin/curl-ca-bundle.crt, as illustrated by this blog post:

A much easier fix is just to set http.sslcainfo to the absolute path of the curl-ca-bundle.crt file in your msysGit install’s bin folder:

$ git config --global http.sslcainfo "/c/Program Files (x86)/Git/bin/curl-ca-bundle.crt"

I chose to do this at the --global level so the setting won’t be overwritten by future msysGit installs.

这篇关于无法通过curl访问github的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆