25 Feb 2018
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:
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
fatal: HttpRequestException encountered. An error occurred while sending the request. Username for 'https://github.com':
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/'
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
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
Restart your machine.
Enter a git command in the command line and you will be prompted to login again.
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
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.
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.