我可以通过使用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
当前回答
导致这个问题的另一个原因可能是你的生物钟可能走错了。证书是时间敏感的。
查询当前系统时间。
date -R
您可以考虑安装NTP以从全局NTP池自动将系统时间与可信的internet时间服务器同步。例如,在Debian/Ubuntu上安装:
apt-get install ntp
其他回答
最后,添加http。Sslverify到你的.git/config。
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://server/user/project.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[http]
sslVerify = false
不需要将git SSL验证设置为false。这是由于系统中没有所有的CA授权证书。大多数拥有真正SSL证书的人都缺少中间证书。
只需将中间证书全文(缺失CA和中间证书的全链)添加到
sudo gedit /etc/ssl/certs/ca-certificates.crt
不运行update-ca-certificates即可工作。
对于手动生成的证书也一样,只需添加CA证书文本。
最后:Push successful:一切都是最新的
我在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列表,它工作。
检查你的系统时钟,
美元的日期
如果不正确,证书检查将失败。要纠正系统时钟,
安装NTP
时钟应该自动同步。
最后再次输入clone命令。
我知道已经有很多答案了。对于那些使用专用网络(如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