SSL works with browser, wget, and curl, but fails with git

前端 未结 6 1787
北海茫月
北海茫月 2021-01-31 04:23

I have a website I am using to host redmine and several git repositories

This works perfectly for http, but I can\'t clone with https, i.e.

git clone htt         


        
6条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-31 05:06

    XCondE's answer will address the problem, but turning off security warnings always feels like a bad idea. If you're running on an ubuntu box, then the issue may be that the CA certificate for your web server isn't in the /etc/ssl/certs/ca-certificates.crt file. I ran into this with a git server hosted on a web server with a SSL certificate signed by www.incommon.org.

    You can add the intermediate certificate to your ca-certificates file, as follows:

    wget http://cert.incommon.org/InCommonServerCA.crt
    openssl x509 -inform DER -in InCommonServerCA.crt -out incommon.pem
    cat /etc/ssl/certs/ca-certificates.crt incommon.pem > ca-certs2.crt
    sudo cp /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt.bak
    sudo cp ca-certs2.crt /etc/ssl/certs/ca-certificates.crt
    

    There's a good discussion of what's going on behind the scenes here: http://curl.haxx.se/docs/sslcerts.html

提交回复
热议问题