我可以通过使用ssh的克隆项目推送,但它不工作时,我克隆项目与https。
它显示的错误信息是:
server certificate verification failed. CAfile: /etc/ssl/certs/cacertificates.crt CRLfile: none
我可以通过使用ssh的克隆项目推送,但它不工作时,我克隆项目与https。
它显示的错误信息是:
server certificate verification failed. CAfile: /etc/ssl/certs/cacertificates.crt CRLfile: none
当前回答
当我试图在Dockerfile中克隆git时,我的工作是获取SSL证书并将其添加到本地证书列表:
openssl s_client -showcerts -servername git.mycompany.com -connect git.mycompany.com:443 </dev/null 2>/dev/null | sed -n -e '/BEGIN\ CERTIFICATE/,/END\ CERTIFICATE/ p' > git-mycompany-com.pem
cat git-mycompany-com.pem | sudo tee -a /etc/ssl/certs/ca-certificates.crt
学分:https://fabianlee.org/2019/01/28/git-client-error-server-certificate-verification-failed/
其他回答
我知道这是旧的,但有时错误再次弹出。如果您确信可以信任本地安装,那么只需在变量部分中添加:GIT_SSL_NO_VERIFY: "true"。通过这种方式,您只需禁用证书验证。
此解决方案与本文提出的解决方案类似,但它仅适用于当前git树,而不适用于全局git配置。
我在GitLab服务器上遇到了这个问题。通过cmd更新Linux的可信CA列表后解决了这个问题:
sudo apt-get install --reinstall ca-certificates
以下是步骤:
git跟踪返回如下错误:
GIT_CURL_VERBOSE=1 GIT_TRACE=2 git clone https://mygitlab
...
...
* SSL connection using TLS1.2 / ECDHE_RSA_AES_256_GCM_SHA384
* server certificate verification failed. CAfile: none CRLfile: none
* Closing connection 0
**fatal: unable to access 'https://mygitlab/some.git/': server certificate verification failed. CAfile: none CRLfile: none**
查看git服务器的CA Issuer:
echo -n | openssl s_client -showcerts -connect yourserver.com:YourHttpGilabPort \
2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
| openssl x509 -noout -text | grep"CA Issuers" | head -1
...
...
CA Issuers - URI:http://r3.i.lencr.org/
为什么r3.i.lencr.org不可信?我尝试更新CA列表,它工作。
将证书和bundle复制到一个.crt文件中,并确保文件中的证书之间有一个空行。
在互联网上尝试了所有方法之后,我在GitLab服务器上使用了这个方法。
检查你的系统时钟,
美元的日期
如果不正确,证书检查将失败。要纠正系统时钟,
安装NTP
时钟应该自动同步。
最后再次输入clone命令。
让我们加密2021年9月30日根CA到期
这个错误的另一个来源是一个过期的根CA,如果你使用Let's Encrypt,它昨天发生在其中一个根CA上: https://docs.certifytheweb.com/docs/kb/kb-202109-letsencrypt/
您可以通过运行来确认
openssl s_client -showcerts -connect $hostname:$port -servername $hostname | grep "certificate has expired"
在这种情况下,您需要在/etc/gitlab/ssl/$hostname.crt中编辑gitlab证书
将文件中过期的DST根CA X3块替换为https://letsencrypt.org/certs/isrgrootx1.pem的内容,并重新加载服务器。