43

Problem

I recently encountered the following message when I pushed to a GitHub repo:

"fatal: HttpRequestException encountered. " followed by being prompted for my username and password again.

From previous searches, Visual Studio and various others have the same root problem. For those lazier than I am, a summary of the various solutions for different applications/OS are here with relevant discussions. Hopefully people find this helpful.

Reason

Can't really call updating sercurity a problem, so here's the reason. The issue is GitHub has removed TLS-1.0 support which is causing the problem with clients including Microsoft Visual Studio's built in git client, versions of Git below 1.14 as well as GUI clients includint tortoiseGit, etc. The full release notes can be found here: https://githubengineering.com/crypto-removal-notice/

Bitbucket will drop TLSv1.0 and TLSv1.1 starting 1 Dec 2018. I expect similar problems as before.

Solution

Edit: moved my self-answer to an answer box. See below.

Eric Bringley
  • 1,166
  • 1
  • 9
  • 20
  • You should edit this and move the answer into an actual, separate answer. Self-answering is fine, but you've posted a question including the answer, all in the question box. – Benjamin W. Mar 02 '18 at 17:09

4 Answers4

43

Git hub has removed TLS-1.0 from it's authentication services. https://githubengineering.com/crypto-removal-notice/

Solutions

Windows Clients

Use Version 2.14.3 (or newer) of Git for Windows and newer include an up-to-date Git Credential Manager for Windows: https://gitforwindows.org/

You can also explicitly update your Git Windows Credencial Manager to the latest version, 1.14.0, to get TLS-1.2 support: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.14.0

Visual Studio Clients

It is suggested to update your client to VS 2017 or, if you cannot upgrade, there are two machine-wide registry keys you can set that affect all .NET-based applications on the client machine that you can change... https://developercommunity.visualstudio.com/content/problem/201457/unable-to-connect-to-github-due-to-tls-12-only-cha.html

JDK

TLS-1.2 is default in JDK8 and available in JDK7. https://blogs.oracle.com/java-platform-group/diagnosing-tls,-ssl,-and-https

Red Hat native Git clients

RH 5 does not support TLS-1.2 and GitHubEngineering suggest updating to newer versions of the OS. RH 6.8 and 7.2 will support TLS-1.2. https://www.linuxquestions.org/questions/blog/mensawater-183304/rhel5-wont-support-tlsv1-1-or-higher-36951/

Eric Bringley
  • 1,166
  • 1
  • 9
  • 20
  • 1
    This wasn't a complete solution for me. I use Git 2.15, which uses TLS 1.2. My server is Bitbucket so this might not apply to Github, but: The git operations succeed but _still_ print "fatal: HttpRequestException encountered", so they look like failures. Verbose output shows: ``` < HTTP/1.1 401 Unauthorized * Authentication problem. Ignoring this. < ... * Closing connection 0 fatal: HttpRequestException encountered. An error occurred while sending the request. ``` ... followed by a HTTPS request that works. Does this happen to anyone else? – Travis Wilson Dec 04 '18 at 16:14
  • Hi @TravisWilson, if you haven't gotten this figured out by now... was anything on the Bitbucket announcement page useful? – Eric Bringley Dec 12 '18 at 12:51
  • I didn't see anything on the announcement that helped here. I haven't tried too hard to fix it since the git operations _do_ succeed. I (regrettably) got used to ignoring the error messages. – Travis Wilson May 07 '19 at 21:19
  • What is the path for your repository origin? is it http:// instead of https? Just an odd passing thought when wondering why git would try to use HTTP instead of https when you push/pull... P.S. Don't answer the first question. – Eric Bringley May 08 '19 at 16:20
  • Hi. I can't upgrade my git from version 2.8.2 to latest. I still got the 2.8.2 version after running `git --version`. Been searching for hours but nothing. – Lekz Flores May 22 '19 at 05:35
  • @LekzFlores, Can you elaborate on what you've done? I don't know how to help if I don't know what you've done and what system(s) you're working with. It may also be that you may also need to create your own question as this now seems to a problem with installing git instead of the TLS-1.0 support. Presumably, you're trying to implement one of the solutions above. – Eric Bringley May 22 '19 at 12:44
  • I have 2.15 git client, getting same error. I was able to download and switch branch but when i hit `git pull` i get the error. Maybe because the client asks the UN in same commandline window but password it asks in a separate dialog box. Not sure how to fix it. – Raghuveer Feb 12 '21 at 06:57
11

Step 1 Firstly you need to download and install the latest version of the Git Windows Credential Manager.

Here is the link to it on GitHub. https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/latest

Step 2 Restart your machine.

Step 3 Enter a git command in the command line and you will be prompted to login again.

Step 4 If you still get the same fatal error, you will need to update Git by downloading the latest version from here: https://git-scm.com/downloads

Step 5 Enter a git command in the command line and you will be prompted to login again. The problem should be solved now and you should be able to carry on working as normally.

uncle-tee
  • 180
  • 1
  • 8
  • 3
    Should include credits: [source](https://codeshare.co.uk/blog/how-to-solve-the-github-error-fatal-httprequestexception-encountered/) – eckc Aug 28 '18 at 21:37
6

TLS support is discontinued in older versions of git.

Upgrading git on your machine solves this problem.

Download the latest git and install for your machine from here: https://git-scm.com/downloads.

rockey91
  • 122
  • 2
  • 10
-3

Above solution does not work for me. But I have a solution for this, When git asks us for username again on git bash, enter your GITHUB username and password on git bash itself and you will be back on work.