首页 > 解决方案 > 无法克隆 - Git 寻找不正确的证书路径

问题描述

我进入了这个问题的第 5 天,没有任何运气。我已经浏览了 SO 中的帖子,已经报告的错误在本质上略有不同,它们指的是 git 正在寻找的不正确的 curl ca 证书,而在我的情况下,它是不正确的 ca 证书。

C:\Users\Dell2312\Desktop>git clone 
https://sampleurl.githost.io/grp/MyProject.git
Cloning into 'MyProject'...
fatal: unable to access 'https://sampleurl.githost.io/grp/MyProject.git/': 
error setting certificate verify locations:
CAfile: C:/Program Files/Git/mingw64/libexec/ssl/certs/ca-bundle.crt
CApath: none

我首先不明白为什么 git 应该检查不存在的证书并投诉我?我应该做些什么?

PS:请不要引导我通过其他 SO 帖子的链接,我逐行逐行查看这些帖子。他们都没有提出这个问题的根本原因,也没有一个解决方案对我有用。

更新 - 我的 git 配置的详细信息

可以看出,git 查找的路径是 'C:/Program Files/Git/mingw64/libexec/ssl/certs/ca-bundle.crt' 而实际证书路径如下所示是 C:\Program Files\ Git\mingw64\ssl\certs\ca-bundle.crt

复制证书也没有帮助

C:\Users\Dell2312\Desktop>git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
diff.astextplain.textconv=astextplain
rebase.autosquash=true
http.sslcainfo=C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
http.sslcainfo=C:/Program Files/Git/ssl/certs/ca-bundle.crt

C:\Users\Dell2312\Desktop>git config --global --list
http.sslcainfo=C:/Program Files/Git/ssl/certs/ca-bundle.crt

标签: gitgitlab-ci-runner

解决方案


您正在使用 HTTPS 协议来克隆 git 存储库,因此 git 检查证书有效性也就不足为奇了。您可以使用自定义证书颁发机构 (CA),显然您的安装/配置存在与 CA 位置有关的问题。

您的配置可以列出:

git config --list
git config --global --list

也许你sslCA*设置了一些变量?

如果您信任 sampleurl.githost.io,您可以尝试跳过 SSL 验证是否适合您:

GIT_SSL_NO_VERIFY=true git clone https://sampleurl.githost.io/grp/MyProject.git

推荐阅读