What is the right .gitconfig syntax for http.sslCAInfo certificate for specific server?

user923543 picture user923543 · Apr 25, 2014 · Viewed 17k times · Source

I'm using a remote git repository via https, which has a self-signed certificate. To make git aware of the self-signed certificates, I have the following in my .gitconfig:

[http]
sslCAInfo = /home/user/myselfsigned.cert

This works fine, but when I add another remote with a CA signed certificate, git (or curl?) wrongly tries to use the cert file for this remote, too. What is the correct syntax to apply the certificate to a specific remote?

Answer

shtolik picture shtolik · Oct 20, 2014

I think that question has answer to your question as well:

git config http."https://code.example.com/".sslCAInfo <downloaded certificate>.pem

And gitconfig file will be smth like:

[http "https://code.example.com/"]
    sslCAinfo = /path/to/<downloaded certificate>

Although it doesn't work for me yet...