Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to access github via curl

Tags:

github

curl

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.
like image 757
priya Avatar asked Jul 20 '26 21:07

priya


2 Answers

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.

  • other alternatives are detailed in "HTTPS github access"
like image 106
VonC Avatar answered Jul 23 '26 12:07

VonC


If you don't want to use --cacert option (why?), as suggested in text, use another suggestion about -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
like image 43
Lazy Badger Avatar answered Jul 23 '26 11:07

Lazy Badger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!