【问题标题】:curl: (60) SSL certificate problem: self signed certificatecurl:(60)SSL证书问题:自签名证书
【发布时间】:2020-09-20 10:10:15
【问题描述】:

我想在我的 Linux 计算机上安装 nvm。 (我的 Debian 版本是 10。)

我阅读了这份文件https://github.com/nvm-sh/nvm#install--update-script 我输入了这个脚本。

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

这是结果。

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

我阅读了这份文档https://curl.haxx.se/docs/sslcerts.html,但我不明白该怎么做。于是上网一搜,发现需要代理配置。

export http_proxy="http://webfilter.**********.com:8000/"
export https_proxy="http://webfilter.**********.com:8000/"

我在终端中输入了这些命令并再次尝试了这个脚本。

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

然后我得到相同的结果。

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

我该如何解决这个问题?

【问题讨论】:

    标签: ssl github curl proxy


    【解决方案1】:

    发现我需要代理配置。

    在调用之前先检查您是否确实需要任何代理。
    For instance(未导出代理):

    curl -Is http://www.google.com | head -1 | grep 200; if [[ $? -eq 0 ]]; then; echo "Online"; else; echo "Offline"; fi
    

    如果可行,那么问题就不同了。
    如果没有,请使用您的代理重试。

    【讨论】:

    • @KazuakiSuzuki 然后先简化,只用curl -Is http://www.google.com | head -1 | grep 200进行测试
    • @KazuakiSuzuki 这意味着您不需要代理。
    • @KazuakiSuzuki 你能检查一下你是否安装了 openssl 包吗? (如*.com/a/57885621/6309
    • @KazuakiSuzuki 你是什么版本的 Git,git config -l 返回什么?有什么与http.sslXXX 相关的吗? (git-scm.com/docs/git-config#Documentation/…) 我在*.com/a/35824116/6309 中提到了http.sslCAinfo
    • @KazuakiSuzuki 可能,如*.com/a/35824116/6309 中所述(重新安装 ca-certificate 是一个很好的提示)。但是将 Git 升级到 2.27(或至少 2.26.2)也是明智的,以检查问题是否仍然存在。