我得到以下错误使用卷曲:

curl: (77) error setting certificate verify locations:
  CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none

如何设置证书验证位置?


当前回答

无论如何,检查正在运行哪个curl也很重要。

我维护的共享机器上的一个用户得到了这个错误。但原因是他们安装了Anaconda (http://continuum.io)。这样做会把Anaconda的二进制路径放在标准的$ path之前,并且它自带curl二进制文件,它很难找到安装在这台Ubuntu机器上的默认certs。

其他回答

似乎您的卷曲指向一个不存在的文件与CA证书或类似。

有关CA certs与curl的主要参考,请参见:https://curl.haxx.se/docs/sslcerts.html

从$ man curl:

--cert-type <type>
    (SSL) Tells curl what certificate type the provided  certificate
    is in. PEM, DER and ENG are recognized types.  If not specified,
    PEM is assumed.

    If this option is used several times, the last one will be used.

--cacert <CA certificate>
    (SSL) Tells curl to use the specified certificate file to verify
    the peer. The file may contain  multiple  CA  certificates.  The
    certificate(s)  must be in PEM format. Normally curl is built to
    use a default file for this, so this option is typically used to
    alter that default file.

我使用MobaXterm,实习生使用Cygwin,所以即使在安装ca-certificates后使用apt-cyg安装ca-certificates问题也没有解决。

我仍然得到以下错误:

curl:(77)错误设置证书验证位置:CAfile: /etc/ssl/certs/ca-certificates. confcrt CApath: none

然后我试着列出文件/etc/ssl/certs/ca-certificates。crt和我都找不到。但是我可以找到/usr/ssl/certs/ca-bundle.因此,我复制了文件/usr/ssl/certs/ca-bundle. crtCRT为/etc/ssl/certs/ca-certificates。CRT和问题得到了解决。

只要找到适合我的解决方案。

echo’cacert = / etc / ssl / certs / ca-certificates。欧洲委员会

我从这里找到了解

把这个放到你的。bashrc中

# fix CURL certificates path
export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt

(见罗伯特的评论)