How to solve the GitHub error fatal: HttpRequestException encountered

Posted written by Paul Seal on February 25, 2018 Umbraco

I had an issue with GitHub when trying to push or pull.

It was asking me to log in every time, but still failing with an error.

1

Here are the error messages I was getting from all 3 ways I work with GitHub:

Visual Studio

Git failed with a fatal error.
HttpRequestException encountered.
   An error occurred while sending the request.
cannot spawn askpass: No such file or directory
could not read Username for 'https://github.com': terminal prompts disabled

Command Line

fatal: HttpRequestException encountered.
   An error occurred while sending the request.
Username for 'https://github.com':

TortoiseGit

fatal: HttpRequestException encountered.
An error occurred while sending the request.
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/username/reponame.git/'

What has caused the error?

It is my understanding that GitHub has switched to using TLS 1.2, which is causing this error when your program is still trying to connect to GitHub using TLS 1.0.

If you want to improve your knowledge of GitHub you should definitely try this course on Pluralsight GitHub for Windows Developers

How to solve it

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

2

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.

Visual Studio

If you are using the GitHub extension for Visual Studio, click on the Tools menu, click on Extensions and Updates, and you may have an update for the GitHub Extension and possibly one for Visual Studio itself. Install these and it should solve the issue for you.