【转载】【有用】gitee 拉取或push 代码https 协议的地址发生证书错误的解决(server certificate verification failed. CAfile: /etc/s)

2023-12-21

问题描述:
从GitHub地址下载内容,提示服务器证书验证失败,没有CRLfile。
curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

问题原因:
根本原因是计算机不信任对Gitlab服务器上使用的证书进行签名的证书颁发机构。
这并不意味着证书可疑,它可以是自签名的,也可以由不在系统的CA列表中的机构/公司签名。

curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA) public keys (CA certs).
#curl默认情况下使用“捆绑包”执行SSL证书验证,证书颁发机构(CA)公共密钥(CA证书)。
If the default bundle file isn't adequate, you can specify an alternate file using the --cacert option.
#如果默认捆绑文件不足,您可以指定备用文件使用--cacert选项。
If this HTTPS server uses a certificate signed by a CA represented in the bundle, the certificate verification probably failed due to a problem with the certificate (it might be expired, or the name might not match the domain name in the URL).
#如果此HTTPS服务器使用由表示为捆绑软件,证书验证可能由于证书有问题(证书可能已过期,或者名称可能与网址中的域名不匹配)。
If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option.
#如果您要关闭curl对证书的验证,请使用 -k(或--insecure)选项。
1
2
3
4
5
6
7
8
问题解决:

方案一:
关闭系统的安全认证。
能解决所有证书问题,操作简单,系统面临一定的风险。
#终端输入命令
export GIT_SSL_NO_VERIFY=1
1
2
方案二:
告诉计算机(系统)信任这个网站的证书(颁发机构)。
能解决GitHub网站证书的问题,且继续保证系统安全,相对复杂。
操作方法以及更多讨论详情,这里有一个看起来很好地回答(并没有亲测)。
Pete Clark:“如果在ubuntu机器上运行,则可能是Web服务器的CA证书不在/etc/ssl/certs/ca-certificates.crt文件中。我遇到了一个托管在Web服务器上的git服务器,该服务器具有由www.incommon.org签名的SSL证书。您可以将中间证书添加到ca-certificates文件中,如下所示:”
wget http://cert.incommon.org/InCommonServerCA.crt
openssl x509 -inform DER -in InCommonServerCA.crt -out incommon.pem
cat /etc/ssl/certs/ca-certificates.crt incommon.pem > ca-certs2.crt
sudo cp /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt.bak
sudo cp ca-certs2.crt /etc/ssl/certs/ca-certificates.crt
————————————————
版权声明:本文为CSDN博主「AUKO16」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_46439193/article/details/105140587

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

【转载】【有用】gitee 拉取或push 代码https 协议的地址发生证书错误的解决(server certificate verification failed. CAfile: /etc/s) 的相关文章

随机推荐