问题
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.
回答1:
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/
回答2:
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.
回答3:
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.
回答4:
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.
来源:https://stackoverflow.com/questions/49067062/fatal-httprequestexception-encountered-error-with-github-bitbucket-repositor