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.

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

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.

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.

Proudly sponsored by

Moriyama

  • Moriyama build, support and deploy Umbraco, Azure and ASP.NET websites and applications.
AppVeyor

  • CI/CD service for Windows, Linux and macOS
  • Build, test, deploy your apps faster, on any platform.
elmah.io

  • elmah.io is the easy error logging and uptime monitoring service for .NET.
  • Take back control of your errors with support for all .NET web and logging frameworks.
uSync Complete

  • uSync.Complete gives you all the uSync packages, allowing you to completely control how your Umbraco settings, content and media is stored, transferred and managed across all your Umbraco Installations.
uSkinned

  • More than a theme for Umbraco CMS, take full control of your content and design with a feature-rich, award-nominated & content editor focused website platform.
UmbHost

  • Affordable, Geo-Redundant, Umbraco hosting which gives back to the community by sponsoring an Umbraco Open Source Developer with each hosting package sold.