打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
【Git笔记】“error:14090086:SSL routines:SSL3
        使用git通过https方式从github clone git repo源码时,报错如下:
[plain] view plain copy
  1. Cloning into 'git'...  
  2. fatal: unable to access 'https://github.com/git/git.git/': SSL certificate problem, verify that the CA cert is OK. Details:  
  3. error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed  

        开启curl verbose选项(用于调试)并重新执行git clone,详细报错信息:

[plain] view plain copy
  1. $ export GIT_CURL_VERBOSE=1  
  2. $ git clone https://github.com/git/git.git     
  3. Cloning into 'git'...  
  4. * Couldn't find host github.com in the .netrc file, using defaults  
  5. * About to connect() to github.com port 443  
  6. *   Trying 192.30.252.128... * connected  
  7. * Connected to github.com (192.30.252.128) port 443  
  8. * successfully set certificate verify locations:  
  9. *   CAfile: /usr/share/ssl/certs/ca-bundle.crt  
  10.   CApath: none  
  11. * SSL certificate problem, verify that the CA cert is OK. Details:  
  12. error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed  
  13. * Closing connection #0  
  14. fatal: unable to access 'https://github.com/git/git.git/': SSL certificate problem, verify that the CA cert is OK. Details:  
  15. error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed  

        从错误提示可知,git通过curl访问https地址时,未能在本机未找到ca证书,从而导致ssl certificate verify failed。

        解决方法:
        Setp1:从curl官网下载cacert.pem文件(下载链接参见这里,关于curl的Server SSL Certificates细节参见这里,其中提到,从curl 7.18.0开始,编译安装curl时默认安装ca证书,而我机器的curl version=7.12.1,curl --version可查看):
[plain] view plain copy
  1. ~$ mkdir ~/tools/https-ca  
  2. ~$ cd ~/tools/https-ca  
  3. ~$ curl http://curl.haxx.se/ca/cacert.pem -o cacert.pem  
        Step2:终端执行下面的命令,以便为git配置ca认证信息:    
[plain] view plain copy
  1. ~$ git config --global http.sslCAInfo /home/slvher/tools/https-ca/cacert.pem  
        可打开~/.gitconfig确认cainfo配置成功写入git配置文件

        完成以上两步后,执行git clone https://github.com/git/git.git成功,问题解决。

【参考资料】
1. StackOverflow: SSL certificate rejected trying to access GitHub over HTTPS behind firewall
2. cURL: Details on Server SSL Certificates

================== EOF =====================


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
RabbitMQ SSL设置
Python urllib3和requests发送HTTPS请求时出现SSLError或InsecureRequestWarning_caused by sslerror(sslcertverific
git clone速度太慢的解决办法
执行Git命令时出现各种 SSL certificate problem 的解决办法
3种方法,完美解决git clone克隆github仓库慢的问题
python接口自动化9-https请求(SSL)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服