简体   繁体   English

Git pull/push - 无法访问 HTTPS,SSL 例程似乎已关闭

[英]Git pull / push - unable to access HTTPS, SSL routines seem to be down

I'm using Git (and GitHub) on a daily basis and everything has been working fine and all of a sudden, I can no longer communicate with my remote GitHub repository through my Git commands.我每天都在使用 Git(和 GitHub),一切正常,突然之间,我无法再通过我的 Git 命令与远程 GitHub 存储库进行通信。 When I try to "Git pull", it gives the following error:当我尝试“Git pull”时,出现以下错误:

fatal: unable to access ' https://github.com/snahrvar/eatibl.git/ ': error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version致命:无法访问“ https://github.com/snahrvar/eatibl.git/ ”:错误:1407742E:SSL 例程:SSL23_GET_SERVER_HELLO:tlsv1 警报协议版本

So, I tested across multiple repositories, and I get the same errors on my computer.因此,我在多个存储库中进行了测试,并且在我的计算机上遇到了相同的错误。 I had someone else interact with those same repositories, and it works fine for them.我让其他人与这些相同的存储库进行了交互,这对他们来说效果很好。 Prior to this error, I did an "npm install sharp" on a project and that ended up failing, and I suspect this may have messed with some SSL setting, but that's a wild guess!在此错误之前,我对一个项目进行了“npm installSharp”,但最终失败了,我怀疑这可能与某些 SSL 设置有关,但这是一个疯狂的猜测!

Any general thoughts or guidance would be much appreciated!任何一般的想法或指导将不胜感激!

If it's helpful at all, here is my environment:如果它有帮助,这是我的环境:

  • Git version: 1.9.4.msysgit.2 Git 版本:1.9.4.msysgit.2
  • Windows version: Windows 8.1 Windows 版本:Windows 8.1

Updating TortoiseGit and GCM didn't help me, but updating Git itself did, as per @Frederic's advice in comments. 根据@Frederic在评论中的建议,更新TortoiseGit和GCM并没有帮助我,但更新Git本身却有帮助。

https://git-scm.com/download/win https://git-scm.com/download/win

To make sure the new version of Git installs properly and doesn't conflict with previous installations (it might, if you used TortoiseGit's, because it would use different folders and mess with PATH variable), remove the existing Git installation before installing the updated Git. 为了确保新版本的Git能够正确安装并且与先前的安装没有冲突(如果使用TortoiseGit,则可能会使用不同的文件夹,并且会混淆PATH变量,因此可能会发生),请在安装更新的Git之前删除现有的Git安装。 。 Might also need to install with administrator rights. 可能还需要以管理员权限安装。

You're likely running into an incompatibility with GitHub's deprecation of weak SSL encryption protocols: 您可能会遇到与GitHub弃用弱SSL加密协议不兼容的情况:

Weak cryptographic standards removal notice 弱加密标准删除通知

The solution will vary, but for Windows you likely need to upgrade the Git credential manager to 1.14.0 解决方案会有所不同,但对于Windows,您可能需要将Git凭据管理器升级到1.14.0。

https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.14.0 https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.14.0

If you are using Android Studio or IntelliJ IDEA, updating Git to the latest version and changing the path to point to the new version solve the problem for me. 如果您使用的是Android Studio或IntelliJ IDEA, 则将 Git更新到最新版本并更改指向新版本的路径可以为我解决问题。

在此处输入图片说明

Using TortoiseGit, I did all of the other fixes/updates given for this and still no success. 使用TortoiseGit,我为此做了所有其他修复/更新,但仍然没有成功。 I found this: Can't git push/pull/fetch suddenly 我发现了这一点: 突然无法git push / pull / fetch

My TortoiseGit settings for Git for Windows Git.exe path was pointing to C:\\Program Files (x86)\\Git\\bin . 我的Windows Git.exe路径的Git的TortoiseGit设置指向C:\\Program Files (x86)\\Git\\bin I changed it to C:\\Program Files\\Git\\bin and now it's working again. 我将其更改为C:\\Program Files\\Git\\bin ,现在又可以正常工作了。

This is what worked for me. 这对我有用。

  1. Install the latest version of Git from here: https://git-scm.com/download/win 从此处安装最新版本的Git: https//git-scm.com/download/win
  2. In TortoiseGit, go to menu SettingsGeneralGit.exe Path - change it from 32-bit to 64-bit path: C:\\Program Files (x86)\\Git\\bin → C:\\Program Files\\Git\\bin 在TortoiseGit中,转到菜单设置常规Git.exe路径 -将其从32位路径更改为64位路径:C:\\ Program Files(x86)\\ Git \\ bin→C:\\ Program Files \\ Git \\ bin

Updating Git was not enough in my situation. 在我的情况下,更新Git是不够的。 After debugging for several hours, this was my fix: 经过几个小时的调试,这是我的解决办法:

C:\wamp64\www\maandlastenmanager> git config http.sslVersion
tslv1.0

C:\wamp64\www\maandlastenmanager> git config http.sslVersion tlsv1.2

C:\wamp64\www\maandlastenmanager> git config http.sslVersion
tslv1.2

I had this same problem while pulling code from GitHub on my Visual Studio Code terminal. Visual Studio Code终端上从GitHub提取代码时,我遇到了同样的问题。 I found the advice in the previous answers useful and hacked a solution together following the steps below: 我发现前面的答案中的建议很有用,并按照以下步骤共同找到了解决方案:

This repository was quite useful. 该存储库非常有用。

I hope this helps someone. 我希望这可以帮助别人。

TL;DR: git config --system http.sslbackend schannel and switch off HTTPS checks for github.com in your antivirus software TL; DR: git config --system http.sslbackend schannel并关闭防病毒软件中对github.com HTTPS检查


I'm using the Git command line on Windows 8 x64. 我在Windows 8 x64上使用Git命令行。 In addition, my antivirus software checks HTTPS traffic by default. 另外,默认情况下, 我的防病毒软件会检查HTTPS流量 Like other people in answering this question, I use GitHub almost daily. 像其他人一样,我几乎每天都在使用GitHub。

  • Updating Git - didn't help - because I used OpenSSL (see below) 更新Git-没有帮助-因为我使用了OpenSSL(请参见下文)
  • Updating credential manager - didn't help 更新凭证管理员-没有帮助

Then I started playing with switching the SSL backend: 然后,我开始切换SSL后端:

git config --system http.sslbackend openssl ----------------vs------------------ git config --system http.sslbackend schannel and the antivirus software checks for SSL traffic: git config --system http.sslbackend openssl ----------------vs------------------ git config --system http.sslbackend schannel和防病毒软件检查SSL流量:

  1. OpenSSL, HTTPS checks ON: error:0407006A:rsa routines:RSA_padding_check_PKCS1_type_1:block type is not 01 OpenSSL,HTTPS检查ON: error:0407006A:rsa routines:RSA_padding_check_PKCS1_type_1:block type is not 01
  2. OpenSSL, HTTPS checks OFF: SSL certificate problem: unable to get local issuer certificate OpenSSL,HTTPS检查OFF: SSL certificate problem: unable to get local issuer certificate
  3. SecureChannel, HTTPS checks ON: schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate. SecureChannel,HTTPS检查ON: schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
  4. SecureChannel, HTTPS checks OFF: worked fine SecureChannel,HTTPS检查OFF:工作正常

PS: Instead of commandline, you can just reinstall the latest Git, selecting "Use native Windows SSL validation library". PS:不用命令行,您只需选择“使用本机Windows SSL验证库”即可重新安装最新的Git。

PPS: The case (3) seems to be a bug in the schannel library, because the MITM certificate my antivirus software uses is whitelisted on my machine. PPS:情况(3)似乎是schannel库中的错误,因为我的防病毒软件使用的MITM证书已在我的计算机上列入白名单。

Same for me with Git 1.9.5.msysgit.1 too. 对我来说,与Git 1.9.5.msysgit.1相同。 I tried to install https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.14.0 , but no change. 我尝试安装https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.14.0 ,但没有更改。

Actually, nothing happen after installation; 实际上,安装后什么也没有发生。 maybe I'm doing something wrong? 也许我做错了什么? (That may not help for the initial question, but for other people, yes!) (这可能对最初的问题没有帮助,但对其他人而言,是的!)

在macOS上,您可以通过Homebrew 安装最新的git

Yeah, I encountered the same issue on a pull request today and the solution was to simply update Git by downloading the latest (2.16.2) 64-bit version of Git for Windows. 是的,我今天在请求请求时遇到了相同的问题,解决方案是通过下载最新(2.16.2)64位版本的Windows Git来简单地更新Git。 It was released 5 days ago, on 2018-02-20. 它于5天前发布于2018-02-20。

The comment by @andw worked for me: @andw的评论对我有用:

Update Git version 1.9.5 to 2.15.1 using these steps: 使用以下步骤将Git版本1.9.5更新为2.15.1:

In sourceTree, go to menu ToolsOptionsGitUse Embedded Git . 在sourceTree中,转到菜单工具选项Git使用嵌入式Git

A quick solution would be git config --global http.sslVerify true , but it is not recommended as it defeats the purpose using SSL. 一个快速的解决方案是git config --global http.sslVerify true ,但是不建议这样做 ,因为它无法达到使用SSL的目的。

A second and better way is to use ssh keys rather than an SSL URL. 第二种更好的方法是使用ssh密钥而不是SSL URL。

Steps to generate SSH keys 生成SSH密钥的步骤

o Run the following command in a Git terminal (Git Bash): ssh-keygen o在Git终端(Git Bash)中运行以下命令: ssh-keygen

After running the command, the following message will appear: 运行命令后,将出现以下消息:

Generating public/private RSA key pair. 生成公共/私有RSA密钥对。

Enter file in which to save the key (/h//.ssh/id_rsa): 输入要保存密钥的文件(/h//.ssh/id_rsa):

Give the path for the key to be stored in, for example, enter the file in which to save the key (/h//.ssh/id_rsa): C:\\Users\\Public\\my-new-ssh-key 提供密钥的存储路径,例如,输入要保存密钥的文件(/h//. C:\\Users\\Public\\my-new-ssh-key id_rsa): C:\\Users\\Public\\my-new-ssh-key

Then give the passphrase for that key (any password of minimum 8 characters) 然后提供该密钥的密码短语(任何至少8个字符的密码)

• Next run the following command: eval “$(ssh-agent –s)” •接下来,运行以下命令:eval“ $(ssh-agent –s)”

• Run the following command: ssh-add C:/Users/Public/my-new-ssh-key Note: use forward slash in the path to the newly created SSH key. •运行以下命令: ssh-add C:/Users/Public/my-new-ssh-key注意:在新创建的SSH密钥的路径中使用正斜杠。

After that, add the contents of the file my-new-ssh-key.pub and add it in the text area for Add public key (Bitbucket, GitHub, etc.) 之后,添加文件my-new-ssh-key.pub的内容,并将其添加到添加公钥 (Bitbucket,GitHub等)的文本区域中。

While connecting to a remote repository to fetch, pull, push, etc., I had the same error: 连接到远程存储库以获取,拉取,推送等时,我遇到了相同的错误:

fatal: unable to access 'https://github.com/repository.git/': error:1
407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

I just reinstalled Git 64-bit in place of 32-bit and that fixed the issue. 我只是重新安装了Git 64位而不是32位,这解决了该问题。

After installation, verify the Git path in environment variables. 安装后,请验证环境变量中的Git路径。 It should be: 它应该是:

C:\Program Files\Git\bin\git.exe

This is an issue with IntelliJ and RubyMine. 这是IntelliJ和RubyMine的问题。 GitHub must have disabled SSL (PCI compliance maybe?) in favor of TLS. GitHub必须禁用SSL(也许符合PCI?),以支持TLS。 If you open Settings in IntelliJ or RubyMine and navigate to Version Control > Git, you'll see it's using a git.exe installed under the application's path. 如果您在IntelliJ或RubyMine中打开“设置”并导航至“版本控制”>“ Git”,则会看到它正在使用安装在应用程序路径下的git.exe。 You should download the most current version of Git and change the path in your VCS settings to point to that, eg C:\\Program Files\\Git\\bin\\git.exe if you install it on Windows. 您应该下载最新版本的Git,并在VCS设置中更改路径以指向该路径,例如,如果在Windows上安装它,则C:\\ Program Files \\ Git \\ bin \\ git.exe。 Works like a charm after that. 在那之后就像魅力一样。

有时,这是由于过时的msysgit使用旧的ssl而不再维护的,您可以为Windows安装最新的git ,然后将tortoise设置中的git.exe路径指向它,然后此问题就消失了。

Encountered a similar error. 遇到类似的错误。 On windows, Updated git on windows to the latest version. 在Windows上,将Windows上的git更新到最新版本。 That fixed the problem. 这解决了问题。

Git version upgrade did the trick for me. Git版本升级帮了我大忙。 I had the version 1.9.5 and so and I upgraded to 2.21.0 on windows. 我的版本为1.9.5 ,因此在Windows上升级为2.21.0 Also upgrading is very easy. 升级也很容易。 We don't need to uninstall the older version. 我们不需要卸载旧版本。 Download the latest Git installer and just keep on pressing next using default options and the version will be changed to new version and all the old settings will still be working like ssh keys etc. We don't need to generate the keys again and put on github or any other repository. 下载最新的Git安装程序,然后继续使用默认选项继续按下,然后该版本将更改为新版本,所有旧设置仍将像ssh密钥等一样工作。我们无需再次生成密钥并放入github或任何其他存储库。

Earlier my https protocol cloning was not working and giving error 之前我的https协议克隆无法正常工作并给出错误

fatal: unable to access ' https://github.com/tensorflow/models/ ': error:1407742E: SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version 致命:无法访问' https://github.com/tensorflow/models/ ':错误:1407742E:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1警报协议版本

Once I downloaded new version and ran the same clone command it worked without any issues. 下载新版本并运行相同的克隆命令后,它便可以正常工作。

All of sudden, I also came across to this problem and I already had my ssh keys setup and It was working fine but I still regenerated ssh keys, set them up and add the private key to ssh-agent as identity only to be disappointed .突然间,我也遇到了这个问题,我已经设置了 ssh 密钥并且它工作正常,但我仍然重新生成 ssh 密钥,设置它们并将私钥添加到 ssh-agent 作为身份只是很失望。 I then realized that the only change which transpired on my machine was installation of another version of GIT by automatic software updates.然后我意识到我的机器上发生的唯一变化是通过自动软件更新安装了另一个版本的 GIT。 I uninstalled and installed the previous version of GIT and It works like charm now.我卸载并安装了以前版本的 GIT,它现在就像魅力一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM