How to skip SSL certificate verification during git clone

Problem:

When running git clone, you see an error message like

git_clone_ssl_error.txt
Cloning into 'MyProject'...
fatal: unable to access 'https://gitlab.mydomain.com/projects/MyProject.git': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

Solution

The quick solution is to prepend

git_ssl_no_verify.sh
GIT_SSL_NO_VERIFY=true

to the git clone command, example:

git_clone_with_ssl_skip.sh
GIT_SSL_NO_VERIFY=true https://gitlab.mydomain.com/projects/MyProject.git

Note that skipping SSL verification is a security risk, so the correct method of fixing this issue is appropriately updating the CA certificates (something like sudo apt install ca-certificates) but this is sometimes not feasibel since not any outdated computer can be updated easily.


Check out similar posts by category: Git, Linux