LLI Wiki — My Digital Knowledge Base

Git: self-signed certificate in the SSL chain on Windows

Fix the Git error 'self signed certificate in certificate chain' by adding the root certificate of the internal authority to the Git for Windows CA bundle.

When Git accesses an HTTPS repository behind an internal certificate authority, it fails with a self-signed certificate error. The fix is to add the root certificate of that authority to the certificate bundle used by Git.

Symptom

fatal: unable to access 'https://github.com/example/repo.git/': SSL certificate problem: self signed certificate in certificate chain

Export the root certificate

  1. Open certmgr.msc.
  2. Go to Trusted Root Certification Authorities.
  3. Export the authority's certificate in Base-64 format (Base-64 encoded X.509).

certmgr: All Tasks > Export menu on the certificate

Export wizard: Base-64 encoded X.509 (.CER) format

Export wizard: saving the .cer file

Add the certificate to the Git bundle

  1. Copy the content of the exported certificate (PEM text) and paste it into the following file:
C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt

Once the certificate is added, Git commands that access the HTTPS repository work.

Copying the .cer file contents to the end of ca-bundle.crt

Mastodon LLIMastodon SocialFosstodon