fatal: unable to access 'https://github.com/msys2/msys2-installer/': SSL certificate problem: unable to get local issuer certificate
时间: 2025-07-29 14:02:09 AIGC 浏览: 19
<think>我们遇到了一个Git错误:无法访问URL,原因是SSL证书问题(无法获取本地颁发者证书)。
这通常发生在系统缺少必要的根证书时。在Git Bash中,我们可以尝试以下方法解决:
方法1:禁用SSL验证(不推荐,仅临时使用)
```bash
git config --global http.sslVerify false
```
方法2:手动配置根证书(推荐)
1. 下载根证书包(如cacert.pem):
```bash
curl -LO https://curl.se/ca/cacert.pem
```
2. 设置Git使用该证书:
```bash
git config --global http.sslCAInfo /path/to/cacert.pem
```
注意:将`/path/to/cacert.pem`替换为实际路径,例如当前目录的`cacert.pem`可以写为`$(pwd)/cacert.pem`。
方法3:更新系统根证书(适用于Windows)
- 确保系统时间正确。
- 更新Windows根证书:运行`certmgr.msc`,检查“受信任的根证书颁发机构”是否包含常见CA。
方法4:使用Git自带的证书(适用于Git for Windows)
- 找到Git安装目录下的`ssl/certs`文件夹(如`C:\Program Files\Git\mingw64\ssl\certs`)。
- 执行:
```bash
git config --global http.sslCAInfo "C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt"
```
注意路径使用正斜杠。
方法5:更新CA证书包(使用Git Bash)
```bash
# 更新CA证书(如果使用MSYS2环境)
pacman -Sy --needed ca-certificates
```
根据环境选择合适的方法。
§§相关问题§§
1. 如何在不禁用SSL验证的情况下修复Git的SSL证书问题?
2. 在Windows系统中,如何更新受信任的根证书颁发机构?
3. 为什么Git for Windows需要单独配置SSL证书?
4. 除了Git,还有哪些工具在Windows上可能遇到SSL证书问题?
5. 如何检查一个网站的SSL证书链是否完整?</think>遇到 Git 错误 `fatal: unable to access 'https://github.com/...': SSL certificate problem: unable to get local issuer certificate` 时,表示系统无法验证 GitHub 的 SSL 证书。以下是 **Git Bash** 中的解决方案:
### 解决方法:
1. **更新根证书**(推荐):
```bash
# 更新 CA 证书包
pacman -Sy --needed ca-certificates
```
2. **临时禁用 SSL 验证**(仅用于测试):
```bash
git config --global http.sslVerify false # 临时关闭验证
git clone https://github.com/msys2/msys2-installer
git config --global http.sslVerify true # 操作后重新启用
```
3. **手动指定证书路径**:
```bash
# 找到 Git 自带的证书(通常在此路径)
git config --global http.sslCAInfo "C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt"
```
4. **更新系统时间**:
```bash
# 检查时间是否准确(SSL 证书依赖正确时间)
date
# 若时间错误,需在 Windows 设置中校准
```
---
### 根本原因:
- 系统缺少最新根证书(常见于旧版 Windows/Git Bash)
- 防火墙或代理干扰了 SSL 握手
- 系统时间
阅读全文
相关推荐



















