无法克隆 - Git查找不正确的证书路径

时间:2018-06-04 16:30:35

标签: git gitlab-ci-runner

我在这个问题的第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

1 个答案:

答案 0 :(得分:-1)

You are using the HTTPS protocol to clone a git repository, so it is not a surprise that git checks the certificate validity. You have the possibility to use custom certification authorities (CA) and apparently there is a problem with your installation/configuration regarding the location of the CA.

Your configuration can be listed with:

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

Maybe you have some sslCA* variables set?

If you trust sampleurl.githost.io, you can try if skipping the SSL verification works for you:

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