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

它显示的错误信息是:

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

当前回答

我做了什么来解决这个问题在终端(Ubuntu 18.04):

openssl s_client -showcerts -servername www.github.com -connect www.github.com:443

我得到了两个证书块。我将证书块复制到我的证书文件/etc/ssl/certs/ca-certificates.crt。

其他回答

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

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

我在树莓派2上安装了Xubuntu,发现时间上也有同样的问题,NTP和自动服务器同步是关闭的(或者没有安装)。得到国家结核控制规划

sudo apt-get install ntp

将“时间及日期”由“手动”改为“与互联网服务器保持同步”

也有同样的问题。由自己颁发的证书颁发机构引起。 通过在/usr/local/share/ca-certificates/中添加.pem文件解决 和调用

sudo update-ca-certificates

PS:“/share/ca-certificates”文件夹下的pem文件必须有扩展名。crt

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

对我有用。

我搞砸了我的CA文件,而我设置goagent代理。不能从github拉数据,并得到相同的警告:

服务器证书验证失败。CAfile: /etc/ssl/certs/ca-certificates。crt CRLfile:无

使用Vonc的方法,从github获取证书,并将其放入/etc/ssl/certs/ca-certificates。Crt,问题解决了。

echo -n | openssl s_client -showcerts -connect github.com:443 2>/dev/null | sed -ne '/- begin CERTIFICATE-/,/- end CERTIFICATE-/p'