我可以通过使用ssh的克隆项目推送,但它不工作时,我克隆项目与https。

它显示的错误信息是:

server certificate verification failed. CAfile: /etc/ssl/certs/cacertificates.crt CRLfile: none

当前回答

这可能听起来微不足道;然而,修正我的约会日期,问题就解决了。检查你的日期和时间是否正确。

其他回答

将证书和bundle复制到一个.crt文件中,并确保文件中的证书之间有一个空行。

在互联网上尝试了所有方法之后,我在GitLab服务器上使用了这个方法。

我知道已经有很多答案了。对于那些使用专用网络(如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 

今天我在freedesktop.org上使用Git for Windows时遇到了这个问题。我把git版本从2.28更新到2.35,问题就解决了。可能是windows版本的集成shell环境没有更新的证书。

希望这对使用Windows版本的用户有所帮助。

我在老旧的Ubuntu 16.04和GitLab上也遇到了同样的问题(其他电脑运行得很好)。

这个问题实际上是Git内部使用的旧版本的gnutls库。这个旧的库对服务器端的证书顺序很敏感——这个问题中有更多信息。最终的解决方案很简单:

apt-get update
apt-get upgrade libgnutls*

注意:这具有重大的安全影响。

如果您在专用网络中使用git服务器,并使用自签名证书或IP地址证书;你也可以简单地使用git全局配置来禁用SSL检查:

git config --global http.sslverify "false"