我可以通过使用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/
其他回答
注意:这具有重大的安全影响。
打开终端,执行以下命令:
export GIT_SSL_NO_VERIFY=1
它为我工作,我使用Linux系统。
我知道这是旧的,但有时错误再次弹出。如果您确信可以信任本地安装,那么只需在变量部分中添加:GIT_SSL_NO_VERIFY: "true"。通过这种方式,您只需禁用证书验证。
此解决方案与本文提出的解决方案类似,但它仅适用于当前git树,而不适用于全局git配置。
导致这个问题的另一个原因可能是你的生物钟可能走错了。证书是时间敏感的。
查询当前系统时间。
date -R
您可以考虑安装NTP以从全局NTP池自动将系统时间与可信的internet时间服务器同步。例如,在Debian/Ubuntu上安装:
apt-get install ntp
对于Windows上的MINGW64 Git Bash用户
以管理员身份启动Git Bash 在MINGW64终端中运行: echo -n | openssl s_client -showcerts -connect yourserver.com: yourhttpgitlabport 2>/dev/null | sed -ne '/- begin CERTIFICATE-/,/- end CERTIFICATE-/p' >> /c/Program\ Files/Git/mingw64/ssl/certs/ca-bundle.trust.crt 以管理员身份关闭Git Bash 启动Git Bash(不是管理员) 在MINGW64终端中运行: $ git配置——global http。sslBackend schannel $ git配置——global http。sslverify真实
Linux/Debian使用:
sudo cp /etc/ca-certificates.conf /etc/ca-certificates.conf.orig
sudo nano /etc/ca-certificates.conf
Change “mozilla/DST_Root_CA_X3.crt” in “!mozilla/DST_Root_CA_X3.crt” an save
sudo update-ca-certificates
https://talk.plesk.com/threads/lets-encrypt-root-certificate-expiration-on-30-september-2021.362224/