In git i have problems with SSL. I spoke with company security and they gave me a .cer file and i installed it. I have Windows. After installing it still doesn't work ssl. They said that i should install it to be recognized by git. How do i do that exactly? I tried to use command "git config --global http.sslCAInfo C:\Users\jeany\Downloads\root-ca.cer" and i have this error "> git pull --tags origin fe/31
fatal: unable to access 'https://gitlab.jeany.eu/delivery-chapters/streams/yep/old-javaca/scala/lala.git/': SSL certificate problem: unable to get local issuer certificate. I need somehow to install it as crt?
"
Assistant
I'm sorry to hear that you're experiencing issues with Git and SSL certificates on Windows. The error you're encountering typically occurs when Git cannot verify the SSL certificate presented by the server because it doesn't recognize the certificate authority (CA) that issued it. This is common in corporate environments with internal CAs.
I'll guide you through the steps to resolve this issue:
Ensure the Certificate is in the Correct Format
Git (specifically, the OpenSSL library it uses) expects certificates in PEM format. Sometimes, .cer files are in DER format, which is binary and not directly usable by OpenSSL.
A. Check the Certificate Format
Open the .cer file using a text editor like Notepad.
If it starts with -----BEGIN CERTIFICATE----- and is readable text, it's in PEM format.
If it appears as garbled or non-text, it's likely in DER format and needs to be converted.
B. Convert DER to PEM Format (if necessary)
To convert the certificate from DER to PEM format, you can use OpenSSL. Git for Windows includes OpenSSL, which you can access via Git Bash.
Open Git Bash.
Navigate to the directory containing your .cer file:
bash
cd /c/Users/jeany/Downloads/
Run the following command to convert the certificate:
bash
openssl x509 -inform der -in root-ca.cer -out root-ca.pem
This will create a root-ca.pem file in PEM format.
Configure Git to Trust the Certificate
Now that you have the certificate in the correct format, you need to tell Git to trust it.
If your company's SSL certificates are issued by an intermediate CA that chains up to the root CA, ensure that all intermediate certificates are included in the PEM file.
Concatenate the certificates:
bash
cat intermediate.pem >> root-ca.pem
(Adjust the command for Windows or use a text editor to combine the certificates.)
Consult Your IT Department
If you've tried all the above steps and still face issues, it's possible there are additional security measures in place.
Provide them with the details of the error.
Ask if there are any proxy settings or additional certificates required.
Verify if there are specific instructions for configuring Git in your corporate environment.
Summary:
Convert your certificate to PEM format if necessary.
Configure Git to trust the certificate by specifying it directly or appending it to Git's trusted certificates.
Use the Schannel backend to leverage the Windows Certificate Store.
Ensure all intermediate certificates are included if applicable.
Avoid disabling SSL verification for security reasons.
Consult with your company's IT department if issues persist.
Let me know if you need further assistance or if any step isn't clear!