SSL certificate problem: self signed certificate in certificate chain错误的全网详细解决方法

在这里插入图片描述

1. 复现错误


今天使用git clone xxx.git项目时,却报出如下的错误信息:

在这里插入图片描述

SSL certificate problem: self signed certificate in certificate chain错误。

2. 分析错误


正赶上最近ChatGPT比较火,可以借助它来分析错误,如下图所示:

在这里插入图片描述

This problem occurs when the SSL certificate presented by the server is not signed by a trusted certificate authority (CA). Instead, it is a self-signed certificate.

This can happen for a variety of reasons. For example, the website owner may have generated their own SSL certificate instead of purchasing one from a trusted CA. Alternatively, the CA that issued the certificate may not be recognized by the web browser being used to access the website.

When a self-signed certificate is encountered, the web browser will display a warning message to the user. The message will indicate that the certificate is not trusted and may be fraudulent. This can cause users to be wary of the website and may discourage them from continuing to use it.

To resolve this problem, website owners should obtain a valid SSL certificate from a trusted CA. This will ensure that users do not encounter any warning messages and can trust that their connection to the website is secure.

不过,ChatGPT是英文回复,不妨将其翻译成中文,如下所示:

当服务器提供的SSL证书未由受信任的证书颁发机构 (CA) 签名时,会出现此问题。相反,它是一个自签名证书。

发生这种情况的原因多种多样。例如,网站所有者可能已生成自己的 SSL 证书,而不是从受信任的CA 购买证书。或者,用于访问网站的Web浏览器可能无法识别颁发证书的CA

遇到自签名证书时,Web浏览器将向用户显示一条警告消息。该消息将指示证书不受信任,可能是欺诈性的。这可能会导致用户对网站保持警惕,并可能阻止他们继续使用它。

若要解决此问题,网站所有者应从受信任的CA获取有效的SSL证书。这将确保用户不会遇到任何警告消息,并且可以相信他们与网站的连接是安全的。

扫描二维码关注公众号,回复: 14958166 查看本文章

ChatGPT回复了这么多,总之一句话,就是SSL认证失败。

它说发生这种情况的原因很多,如下所示:

  1. 网站所有者可能已生成自己的SSL证书,而不是从受信任的CA购买证书。

  2. 用于访问网站的Web浏览器可能无法识别颁发证书的CA

然而,我只是从gitlab上下载代码,不需要购买ssl证书。

看来,ChatGPT并没有解决我的错误,只能通过自己的分析来解决错误。

既然说ssl认证失败,那么,关闭SSL的认证即可。

那么,怎么关闭ssl认证呢?

3. 解决错误

打开Git Bash运行如下命令

export GIT_SSL_NO_VERIFY=true
git config --global http.sslVerify "false"

或者,在windows的命令行中,进入到git命令所在的磁盘位置,执行下面的git命令:

git config --global http.sslVerify false

猜你喜欢

转载自blog.csdn.net/lvoelife/article/details/129862925