Git Clone Fails: Server Certificate Verification Failed

22,788

Solution 1

Ok, I found the solution... I guess a script (I hadn't looked at) ran on my computer which ran the line

git config --global http.sslVerify true

So the solution was simply to change run

git config --global http.sslVerify false

Heh...

Solution 2

I get same error like this and I run following command:

export GIT_SSL_NO_VERIFY=1

It works for me and I am using Ubuntu OS.

Solution 3

Careful with disabling security features like certificate verification! This error indicates that there's some misconfiguration of your machine, assuming GitHub.com actually does have a valid cert. Overriding the error by disabling verification just adds more configuration issues without resolving the underlying problem.

In my case, I discovered that my system clock was wrong, and was set before the GitHub.com certificate was supposed to be valid. Fixing the clock resolved the issue without needing to expose my machine to security threats.

Share:
22,788
Msquared
Author by

Msquared

Updated on July 10, 2022

Comments

  • Msquared
    Msquared almost 2 years

    I've been unable to git clone just about any github repo because of this error

    fatal: unable to access 'github_url': server certificate verification failed. CAfile: /home/ubuntu/.ssh/rel3_dodroot_2048.crt CRLFile: none

    I've noticed a few other people have had a similar error, but with the certificate in the .ssl folder. I've never seen anyone have this problem with the certificate in the .ssh though, and I have no idea how to fix it.

    Environment:

  • Msquared
    Msquared almost 8 years
    I don't follow. In my account settings it doesn't list any ssh keys
  • Admin
    Admin almost 8 years
    TRy adding an SSH key in your Git account settings.
  • user4002112
    user4002112 about 4 years
    I was trying to download using git clone in an ubuntu vm which I created on my PC. This worked for me.
  • Girl Spider
    Girl Spider over 2 years
    This answer should at least add a warning saying doing this could potentially increase your security risk. You are disabling SSL verification, and on a global scale. Ideally, you add that git server's certificate to your local machine so it will trust this server. Even if you don't do that, disable SSL verify in the one repo only, not globally.
  • Daniel Bişar
    Daniel Bişar over 2 years
    +1 great. And you can use it without making the change permanent like 'GIT_SSL_NO_VERIFY=1 git clone ...' which is better for security.