Git Clone 使用 Watt/Steam++ 加速时报证书错误的原因与解决方法

1. 问题现象

执行:

bash 复制代码
git clone https://github.com/PX4/PX4-Autopilot.git

报错:

text 复制代码
fatal: 无法访问 'https://github.com/PX4/PX4-Autopilot.git/':server certificate verification failed. CAfile: none CRLfile: none

这类错误说明 Git 在访问 GitHub 的 HTTPS 地址时,无法完成服务器证书校验。

2. 根本原因

本次问题不是 PX4 仓库的问题,也不是 GitHub 仓库地址写错。

原因是使用了 Watt/Steam++ 加速器后,HTTPS 流量会经过本地加速/代理服务。该服务会使用自己的本地根证书,例如:

text 复制代码
SteamTools Certificate
BeyondDimension

如果 Linux/Ubuntu 系统没有信任这个证书,Git 就会拒绝连接,并报证书校验失败。

本机证书文件位置为:

bash 复制代码
/home/sg/.local/share/Steam++/Plugins/Accelerator/SteamTools.Certificate.cer
/home/sg/.local/share/Steam++/Plugins/Accelerator/SteamTools.Certificate.pfx

其中 .cer 是系统信任链更常用的证书格式,.pfx 通常是包含证书和私钥的证书包。

3. 推荐解决方法:安装到系统 CA

推荐把 Watt/Steam++ 的证书安装到 Ubuntu/Linux 的系统证书库。

已经准备好的脚本:

bash 复制代码
~/bin/install-steamtools-system-ca.sh

执行:

bash 复制代码
~/bin/install-steamtools-system-ca.sh

脚本内容做了这些事情:

text 复制代码
1. 检查 SteamTools.Certificate.cer 是否存在且有效
2. 安装到 /usr/local/share/ca-certificates/steamtools.crt
3. 删除之前错误的空证书 /usr/local/share/ca-certificates/steam-plus.crt
4. 执行 sudo update-ca-certificates --fresh
5. 让 Git 回到使用系统证书库

注意:这个步骤需要输入当前 Linux 用户的 sudo 密码。

4. 手动修复命令

如果不使用脚本,也可以手动执行:

bash 复制代码
sudo install -m 0644 \
  /home/sg/.local/share/Steam++/Plugins/Accelerator/SteamTools.Certificate.cer \
  /usr/local/share/ca-certificates/steamtools.crt

sudo rm -f /usr/local/share/ca-certificates/steam-plus.crt
sudo update-ca-certificates --fresh

git config --global --unset http.sslCAInfo 2>/dev/null || true
git config --global http.sslVerify true

然后重新 clone:

bash 复制代码
cd ~/SG/learn-sg
git clone https://github.com/PX4/PX4-Autopilot.git

5. 验证方法

查看 Git 的 SSL 配置:

bash 复制代码
git config --show-origin --get-regexp 'http\.ssl'

正常情况下可以只看到:

text 复制代码
http.sslverify true

或者没有额外的 http.sslCAInfo 配置,让 Git 使用系统默认证书库。

查看系统是否安装了证书:

bash 复制代码
ls -l /usr/local/share/ca-certificates/steamtools.crt

查看证书内容:

bash 复制代码
openssl x509 \
  -in /usr/local/share/ca-certificates/steamtools.crt \
  -noout -subject -issuer -dates

预期能看到类似:

text 复制代码
subject=CN = SteamTools Certificate, OU = Technical Department, O = BeyondDimension, C = CN
issuer=CN = SteamTools Certificate, OU = Technical Department, O = BeyondDimension, C = CN

6. 备选方法:只给 Git 配置信任证书

如果当前环境不能使用 sudo,可以使用 Git 用户级 CA 配置。

已经准备好的脚本:

bash 复制代码
~/bin/fix-watt-git-ca.sh

使用 .cer

bash 复制代码
~/bin/fix-watt-git-ca.sh \
  /home/sg/.local/share/Steam++/Plugins/Accelerator/SteamTools.Certificate.cer

使用 .pfx

bash 复制代码
~/bin/fix-watt-git-ca.sh \
  /home/sg/.local/share/Steam++/Plugins/Accelerator/SteamTools.Certificate.pfx

这个方法会生成:

bash 复制代码
~/.config/git/certs/ca-bundle-with-watt.crt

并配置:

bash 复制代码
git config --global http.sslCAInfo ~/.config/git/certs/ca-bundle-with-watt.crt
git config --global http.sslVerify true

这种方法只影响 Git,不影响 curl、apt、Python、Node.js 等其他程序。

7. 不推荐的方法

不要长期使用:

bash 复制代码
git config --global http.sslVerify false

也不要长期使用:

bash 复制代码
GIT_SSL_NO_VERIFY=true git clone https://github.com/PX4/PX4-Autopilot.git

这会关闭 HTTPS 证书校验,虽然可能临时绕过错误,但会降低安全性。

8. 本次排查结论

本次排查中发现:

text 复制代码
/usr/local/share/ca-certificates/steam-plus.crt

是一个 0 字节空文件,所以系统实际上没有导入 Watt/Steam++ 的有效证书。

最终通过安装:

text 复制代码
SteamTools.Certificate.cer

并运行:

bash 复制代码
sudo update-ca-certificates --fresh

解决了 Git clone 时报:

text 复制代码
server certificate verification failed

的问题。

相关推荐
tedcloud1232 小时前
Wand-Enhancer 怎么搭建?开源 Wand 客户端增强与远程控制工具介绍
大数据·服务器·人工智能·开源·音视频
大大大大晴天3 小时前
每天认识一个组件:分布式缓存Alluxio
大数据
AI_Auto5 小时前
架构视角看数字化转型|核心架构:大共享平台+小应用,从按需走向适变
大数据·人工智能·架构·制造
小蒋观天下5 小时前
社区AI智能摄像头完整选型指南
大数据·人工智能·安全·计算机视觉·语音识别·ai大模型
AI 思录5 小时前
Prompt 事故档案(八):日常表达被标为“待校准”,AI 的爹味语法从哪里来
大数据·人工智能·算法·prompt·用户体验·ai合规
2601_965742226 小时前
全媒体运营与短视频代运营,两者有什么区别?
大数据·数据结构·人工智能·算法·ai·媒体
anxiao_m7 小时前
2026企业AI数字孪生选型攻略,不同场景对应不同解决方案
大数据·网络·数据库
SelectDB7 小时前
从 ClickHouse 迁移到 Doris:SQL 兼容、同步与验证清单(实战笔记)
大数据·数据库·数据分析
SelectDB8 小时前
Doris 还是 ClickHouse?一张表说清 6 个关键差异(实战笔记)
大数据·数据库·数据分析
DolphinScheduler社区8 小时前
Apache DolphinScheduler 8 月报:权限安全加固,调度补火上线,性能与稳定性持续提升
大数据·安全·开源·apache·任务调度·海豚调度