不能克隆回购。服务器证书验证失败

Cant clone repo. Server certificate verification failed

当我尝试通过命令克隆存储库时

git clone https://git.lighttpd.net/mirrors/libev.git

我收到一个错误 fatal: unable to access 'https://git.lighttpd.net/mirrors/libev.git/': server certificate verification failed. CAfile: none CRLfile: none

如果设置GIT_CURL_VERBOSE=1

Cloning into 'libev'...
* Couldn't find host git.lighttpd.net in the .netrc file; using defaults
*   Trying 5.9.70.195:443...
* TCP_NODELAY set
* Connected to git.lighttpd.net (5.9.70.195) port 443 (#0)
* found 387 certificates in /etc/ssl/certs
* ALPN, offering h2
* ALPN, offering http/1.1
* SSL connection using TLS1.3 / ECDHE_RSA_AES_256_GCM_SHA384
* server certificate verification failed. CAfile: none CRLfile: none
* Closing connection 0
fatal: unable to access 'https://git.lighttpd.net/mirrors/libev.git/': server certificate verification failed. CAfile: none CRLfile: none

我可以设置 GIT_SSL_NO_VERIFY=1 但这并不能解决问题

P.S。 ubuntu20.04

设置 GIT_SSL_NO_VERIFY 适合我:

➜  ~ GIT_SSL_NO_VERIFY=1 git clone https://git.lighttpd.net/mirrors/libev.git
Cloning into 'libev'...
remote: Enumerating objects: 5237, done.
remote: Counting objects: 100% (5237/5237), done.
remote: Compressing objects: 100% (1580/1580), done.
remote: Total 5237 (delta 3831), reused 4987 (delta 3656)B/s
Receiving objects: 100% (5237/5237), 1.36 MiB | 2.02 MiB/s, done.
Resolving deltas: 100% (3831/3831), done.

git clone https://git.lighttpd.net/mirrors/libev.git 在 Fedora 34 上对我有用(没有 GIT_SSL_NO_VERIFY=1)。也许你需要升级你的 git 包,或者 Ubuntu 20.04 上的 cacerts 包?

顺便说一句,lighttpd 支持许多本机 OS 事件框架,因此与允许 lighttpd 直接使用本机 OS 事件框架相比,将 lighttpd 与 libev 一起使用是不必要的(而且通常稍微慢一些)。

编辑:lighttpd.net 管理员注意到站点证书的 OCSP 状态已过期并且脚本未更新它。这已在服务器端得到更正。

正如@kamilcuk 所建议的那样,请务必在您的计算机上安装证书。

apt install ca-certificates