命令失败 git update-git-for-windows

问题描述 投票:0回答:9

我正在尝试更新我的 Git 并输入以下命令:

$ git update-git-for-windows

显示以下错误:

curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

注意:此问题在Windows更新到1909后开始出现。

git
9个回答
32
投票

我正在使用卡巴斯基防病毒软件,它阻止了更新。

我刚刚禁用了互联网和文件保护,更新命令正常工作。 之后,您可以启用防病毒全面保护。


8
投票

或者只是查看最新文档https://git-scm.com/download/win并运行

winget install --id Git.Git -e --source winget

在 PowerShell 中。


4
投票

在 git bash 中运行

git update-git-for-windows
后,我在我的公司机器 + VPN 上遇到了这个确切的错误消息。

Windows 解决方案(对我有用):

  1. 确定我的 ca-bundle.crt 在我的计算机上的位置
  2. 导航至另一个资源管理器窗口中的
    C:\Users\[UserName]\AppData\Local\Programs\Git\mingw64\bin
  3. 将步骤 1 中找到的 ca-bundle.crt 的副本拖放到步骤 2 文件夹中的 ...\mingw64 中。
  4. ca-bundle.crt 的新副本重命名为 curl-ca-bundle.crt
  5. 关闭 git bash 的所有实例,重新打开 git bash,运行
    git update-git-for-windows

完成这些步骤后,我的下载成功了。希望这可以为另一个疲惫的灵魂节省一些时间来解决这个问题。


2
投票

提供的解决方案都不适合我。起作用的是:

  1. 确定 Git 的安装路径
  2. 进入文件夹中的mingw64
  3. 打开您的 git-update-git-for-windows 文件
  4. 编辑两个可用的curl命令并添加--insecure-k参数
  5. 再次运行 git update-git-for-windows

我在安装时仍然被阻止,可能是因为我们的 EPM 软件,但至少我可以运行更新命令。


1
投票

我建议你使用 Chocolatey 包管理器来升级 git:

choco upgrade git

0
投票

我通过以下步骤解决了这个问题:

  1. 访问 https://curl.se/docs/caextract.html
  2. 下载最后一个cacert-2022-04-26.pem
  3. 重命名为 curl-ca-bundle.crt
  4. curl-ca-bundle.crt移动到C:\Program Files\Git\mingw64中

然后再次运行 git update-git-for-windows


0
投票

这通常发生在防火墙检查 https 连接的内容时。然后,它根据公司根证书颁发新证书。所以对我有用的是将此根证书添加到在 C:\Program Files\Git\mingw64\ssl\certs

C:\Program Files\Git\mingw64\etc\ssl\certs
.
 中找到的 Git 
ca-bundle.crt

文件中。

0
投票

我在 Windows 中有

avast Antivirus

我必须禁用

avast Antivirus
才能更新
git

git update-git-for-windows

确保禁用 Windows 中的防病毒软件。下载完成后,您可能需要激活防病毒软件以保护您的计算机


0
投票

禁用avast 10 分钟 奔跑

git update-git-for-windows

© www.soinside.com 2019 - 2024. All rights reserved.