2012-02-13 39 views
3

嘗試使用以下命令訪問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: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. 

回答

2

隨着msysgit,我有時不得不再次指定爲http.sslcainfo到msysgit正確地拿起正確的CA證書文件。

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

(也presented here並在comments of the GitHub smart http page
如果這不起作用:

  • 嘗試指定的完整路徑:git config --system http.sslcainfo /c/path/to/msysgit/bin/curl-ca-bundle.crt,本blog post所示:

更簡單的修復方法就是將http.sslcainfo設置爲的絕對路徑文件在你的msysGit安裝的bin文件夾:

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

我選擇在--global水平要做到這一點,因此設定不會被未來的msysGit安裝覆蓋。

2

如果你不想使用--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 
+0

**請注意:**此選項禁用SSL證書驗證。 --cacert是首選的方式。 – 2012-09-18 12:31:33

+0

使用cURL進行GitHUb訪問,使SSL有點多餘。使用'-Lk'標誌也可以遵循任何重定向。 – not2qubit 2014-01-28 18:20:49