23

I am trying to clone a repository from Github but I couldn't clone the repo, its failed with TLS certificate verification has been disabled! error.

When I run the git clone command, it redirects to signin on Github its failed with TLS certificate and authentication failed for repo even though enter valid credential.

My Github account is enabled with two-factor authentication.

I have tried with disabling sslverifcation also git config --global http.sslVerify false

Github error message: enter image description here

System specification:

OS: Windows 10

Architecture: 64bit

Please help me on this. Thanks in advance.

M.A.Murali
  • 9,988
  • 36
  • 105
  • 182

5 Answers5

37

This helped me:

1 Re-enable

git config --global http.sslVerify true

to get rid of the "TLS certificate verification has been disabled."

2 Create a personal access token on GitHub: https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

3 When prompted to enter credentials, used my email as user and the personal access token as password

4 To delete a wrong credential follow Where is github authentication token stored on Windows?

user16382594
  • 371
  • 3
  • 3
  • This solves the issue but is generally considered dangerous as disabling `http.sslVerify` exposes to man-in-the-middle attacks. – DataBach Sep 19 '22 at 14:31
5

You can allow git to talk to Windows's own certificate store, by using the following config:

git config --global http.sslBackend schannel

I don't know if this could help the OP, but I imagine it could help some people that end up on this question.

Here is my source: How do I configure Git to trust certificates from the Windows Certificate Store?

Nacht
  • 3,342
  • 4
  • 26
  • 41
0

You will need to include a certificate if you want to avoid the warning message.

https://docs.gitlab.com/charts/installation/tls.html

Check the link in the message: https://aka.ms/gcmcore-tlsverify

TLS Verification

If you are using self-signed TLS (SSL) certificates with a self-hosted host provider such as GitHub Enterprise Server or Azure DevOps Server (previously TFS), you may see the following error message when attempting to connect using Git and/or GCM:

$ git clone https://ghe.example.com/john.doe/myrepo fatal: The remote certificate is invalid according to the validation procedure. The recommended and safest option is to acquire a TLS certificate signed by a public trusted certificate authority (CA). There are multiple public CAs; here is a non-exhaustive list to consider: Let's Encrypt, Comodo, Digicert, GoDaddy, GlobalSign.

If it is not possible to obtain a TLS certificate from a trusted 3rd party then you should try to add the specific self-signed certificate or one of the CA certificates in the verification chain to your operating system's trusted certificate store (macOS, Windows).

If you are unable to either obtain a trusted certificate, or trust the self-signed certificate you can disable certificate verification in Git and GCM.

JoseJC
  • 758
  • 1
  • 9
  • 20
  • @M.A.Murali, Were you able to solve it with the answer above, which only give the reason but no solution? – xpt Jun 14 '21 at 15:34
0

I faced the same issue but using "init" command before cloning the repo resolved my issue.

$ git init
Sven Eberth
  • 3,057
  • 12
  • 24
  • 29
0

You can disable TLS/SSL verification for a single git command use below command

git -c http.sslVerify=false clone "your git path"

clone your project by above command it will work

Shrut
  • 555
  • 7
  • 13