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

它显示的错误信息是:

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

当前回答

我在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列表,它工作。

其他回答

我刚刚遇到了非常相同的问题,一个git存储库,这总是为我工作。问题是我通过公共WiFi访问它,它会在第一次连接时重定向到专用门户(例如显示广告并同意tos)。

GIT_CURL_VERBOSE=1 git [clone|fetch]…

应该能告诉你问题在哪里。在我的例子中,这是因为cURL在基于NSS构建时不支持PEM证书,因为这种支持在NSS中不是主线(#726116 #804215 #402712等等)。

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates -y 
sudo update-ca-certificates

对我有用。

我遇到了詹金斯的问题。当我更新证书时,我开始面临这个错误。

stderr fatal: unable to access server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt

所以我已经在下面的文件中添加了我的新证书:

/etc/ssl/certs/ca-certificates.crt

该文件的内容如下所示:

-----BEGIN CERTIFICATE-----
blahblha
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
blahblha
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
blahblha
-----END CERTIFICATE-----

只要在底部附上你的证书:

-----BEGIN CERTIFICATE-----
blahblha
-----END CERTIFICATE-----

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/