SSL Cert error of git operations via https

Phanix
·
·
IPFS
·

For remote git repository access, you can use ssh or https. Sometimes you will encounter Error when using https.

reason

If you operate the remote repository through https, such as git clone https://git.domain.com/xxoo.git, sometimes a message like "SSL certificate problem: unable to get issuer certificate" will appear. The main reason is that when using https, the git client will check whether the server's ssl certificate signing unit is in the local list. So if the self-signed ssl certificate is used, or the signing unit is not in the list, this error will appear.

The laziest solution

 $ git config --global http.sslverify false

But this method is equivalent to turning off all ssl authentication, which is not very secure.

normal solution

Because the company uses godaddy's credentials, so take godaddy's as an example.

  • Linux (using ubuntu 16.04 as an example)
     $ wget https://certs.godaddy.com/repository/gdig2.crt.pem # from Godaddy Cert repository https://certs.godaddy.com/repository
    $ sudo mv gdig2.crt.pem /usr/local/share/ca-certificates/gdig2.crt
    $ sudo update-ca-certificates
    
  • windows git bash console
     # First download https://certs.godaddy.com/repository/gd_bundle-g2.crt from Godaddy Cert repository https://certs.godaddy.com/repository
    $ git config --global http.sslCAInfo PATH_TO_DOWNLOAD_CRT_FILE" #If you want to remove the setting, you can git config --global --unset http.sslCAInfo
    

Original link: Phanix's Blog

CC BY-NC-ND 2.0

Like my work? Don't forget to support and clap, let me know that you are with me on the road of creation. Keep this enthusiasm together!