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.

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.

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

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.

About the author

Paul Seal

Umbraco MVP and .NET Web Developer from Derby (UK) who specialises in building Content Management System (CMS) websites using MVC with Umbraco as a framework. Paul is passionate about web development and programming as a whole. Apart from when he's with his wife and son, if he's not writing code, he's thinking about it or listening to a podcast about it.

Related Posts

How to keep your fork up to date with the master repository in GitHub

This post gives you the commands you will need to keep your fork up to date with the master reposito…

Read Post

How to solve the git error fatal: unable to access '\/.config/git/config

This post shows you how to solve the git error fatal: unable to access '\/.config/git/config

Read Post

How to create a custom 404 page handler via a package action in Umbraco

This post shows you how you can use package actions to modify, update, or set configurations for you…

Read Post

Why is Umbraco CMS so rubbish?

You may have used it before, or you may be using it now and the thought might go through your head "…

Read Post