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

它显示的错误信息是:

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

当前回答

导致这个问题的另一个原因可能是你的生物钟可能走错了。证书是时间敏感的。

查询当前系统时间。

date -R

您可以考虑安装NTP以从全局NTP池自动将系统时间与可信的internet时间服务器同步。例如,在Debian/Ubuntu上安装:

apt-get install ntp

其他回答

让我们加密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的内容,并重新加载服务器。

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

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

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

打开终端,执行以下命令:

export GIT_SSL_NO_VERIFY=1

它为我工作,我使用Linux系统。

检查你的系统时钟,

美元的日期

如果不正确,证书检查将失败。要纠正系统时钟,

安装NTP

时钟应该自动同步。

最后再次输入clone命令。