windows:curl: (60) schannel: SEC_E_UNTRUSTED_ROOT (0x80090325)

目录

  • [1. git update-git-for-windows 报错](#1. git update-git-for-windows 报错)
  • [2. 解决方案](#2. 解决方案)
    • [2.1. 更新 CA 证书库](#2.1. 更新 CA 证书库)
    • [2.2. 使用 SSH 连接(推荐)](#2.2. 使用 SSH 连接(推荐))
    • [2.3 禁用 SSL 验证(不推荐)](#2.3 禁用 SSL 验证(不推荐))

1. git update-git-for-windows 报错

shell 复制代码
Lenovo@LAPTOP-EQKBL89E MINGW64 /d/YHProjects/omni-channel-recon-dev (master)
$ git update-git-for-windows
curl: (60) schannel: SEC_E_UNTRUSTED_ROOT (0x80090325) - More details here: https://curl.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 webpage mentioned above.
  • 操作:windows环境使用git update-git-for-windows从我自己的gitee仓库更新代码。
  • 报错信息:curl 在尝试与服务器建立安全连接时,无法验证服务器的 SSL 证书。这可能是因为服务器使用了自签名证书,或者证书链中的某个证书不被客户端信任。
    简而言之:我的本机(即本地 Git 客户端)拒绝验证远程服务器的 SSL 证书

2. 解决方案

2.1. 更新 CA 证书库

Windows操作系统通常会通过Windows Update自动更新根证书。

确保我的操作系统或 Git 客户端的 CA 证书库是最新的,这样可能会包含远程服务器证书的签发机构。

但是我的Windows11确实已经是最新版的了,并且我想起来了,我昨天下班的时候更新了一下Windows,下班之前我都还能正常用git拉项目,更新之后就不行了

至于去使用gitee的CA证书,于我而言就不现实了,我根本拿不到。

2.2. 使用 SSH 连接(推荐)

使用 SSH 而不是 HTTPS 来克隆或更新代码。SSH 方式不需要依赖 SSL 证书验证,通常更安全。

  1. 生成SSH密钥

    shell 复制代码
    ssh-keygen -t rsa -b 4096 -C "[email protected]"
  2. 查看公钥并复制

    shell 复制代码
    cat ~/.ssh/id_rsa.pub
  3. 将复制的公钥放到个人------设置------SSH公钥下

  4. 重新clone,但是选择仓库的ssh地址来进行克隆

    shell 复制代码
    git clone [email protected]:username/repo.git

2.3 禁用 SSL 验证(不推荐)

不推荐的原因如下:

  1. 虽然可以临时禁用 SSL 验证来绕过这个问题,但这会降低安全性,因为它会使你的连接容易受到中间人攻击。
  2. 压根不起作用,临时禁用都不行,还是报错,艹
shell 复制代码
git config --global http.sslVerify false
相关推荐
Stack_guigui18 分钟前
git连接本地仓库以及gitee
git·gitee
Cynthia-石头4 小时前
Git Github Gitee GitLab
git·gitee·github
shut up21 小时前
Git的使用技巧
gitee·github·shell
开挖掘机上班2 天前
Bash shell四则运算
linux·开发语言·bash·shell
不念霉运2 天前
Gitee Wiki:重塑关键领域软件研发的知识管理范式
gitee
无聊的小坏坏3 天前
Linux 权限管理入门:从基础到实践
linux·ubuntu·bash
格格巫ZYX3 天前
Git GitHub Gitee
git·gitee·github
无影无踪的青蛙3 天前
[Windows]在Win上安装bash和zsh - 一个脚本搞定
bash
黎相思4 天前
Git企业级项目管理实战
git·gitee
诚丞成4 天前
苍茫命令行:linux模拟实现,书写微型bash
linux·chrome·bash