我可以通过使用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
当前回答
基于VonC给出的非常好的答案,我刚刚创建了一个bash脚本,将缺失的x509证书安装到证书包中。它适用于基于debian的linux发行版。
#!/bin/bash
CERTIFICATE_PEM=certificate.pem
CERTIFICATE_CRT=certificate.crt
# get certificate
echo -n | openssl s_client -showcerts -connect gitlab.sehlat.io:443 \
2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
> $CERTIFICATE_PEM
# format certificate from PEM (human-readable) to CRT
openssl x509 -in $CERTIFICATE_PEM -out $CERTIFICATE_CRT
# move it to ca-certificates folder & update the bundle file
sudo mv ./$CERTIFICATE_CRT /usr/local/share/ca-certificates/
sudo update-ca-certificates
# configuring git
git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
其他回答
注意:这具有重大的安全影响。
如果您在专用网络中使用git服务器,并使用自签名证书或IP地址证书;你也可以简单地使用git全局配置来禁用SSL检查:
git config --global http.sslverify "false"
对于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真实
我在树莓派2上安装了Xubuntu,发现时间上也有同样的问题,NTP和自动服务器同步是关闭的(或者没有安装)。得到国家结核控制规划
sudo apt-get install ntp
将“时间及日期”由“手动”改为“与互联网服务器保持同步”
我刚刚遇到了非常相同的问题,一个git存储库,这总是为我工作。问题是我通过公共WiFi访问它,它会在第一次连接时重定向到专用门户(例如显示广告并同意tos)。
我知道已经有很多答案了。对于那些使用专用网络(如Zscaler等)的用户来说,如果需要更新rootcert,则可能会出现此错误。如果在Windows机器上使用WSL,这里有一个关于如何实现此更新的解决方案:
#!/usr/bin/bash
# I exported the Zscaler certifcate out of Microsoft Cert Manager. It was located under 'Trusted Root Certification > Certificates' as zscaler_cert.cer.
# Though the extension is '.cer' it really is a DER formatted file.
# I then copied that file into Ubuntu running in WSL.
# Convert DER encoded file to CRT.
openssl x509 -inform DER -in zscaler_cert.cer -out zscaler_cert.crt
# Move the CRT file to /usr/local/share/ca-certificates
sudo mv zscaler_cert.crt /usr/local/share/ca-certificates
# Inform Ubuntu of new cert.
sudo update-ca-certificates