我得到以下错误使用卷曲:
curl: (77) error setting certificate verify locations: CAfile: /etc/ssl/certs/ca-certificates.crt CApath: none
如何设置证书验证位置?
我得到以下错误使用卷曲:
curl: (77) error setting certificate verify locations: CAfile: /etc/ssl/certs/ca-certificates.crt CApath: none
如何设置证书验证位置?
当前回答
我使用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和问题得到了解决。
其他回答
视窗:-
证书从https://curl.se/docs/caextract.html下载 重命名cacert。Pem到curl-ca-bundle.crt 将文件添加到以下任何位置
查看详情https://curl.se/docs/sslcerts.html
我也有同样的问题。事实证明,我的/etc/ssl/certs/ca-certificates。CRT文件格式不正确。最后一个条目是这样的:
-----BEGIN CERTIFICATE-----
MIIEDTCCAvWgAwIBAgIJAN..lots of certificate text....AwIBAgIJAN-----END CERTIFICATE-----
在-----END CERTIFICATE-----前添加换行符后,curl就可以处理证书文件了。
这是非常恼人的发现,因为我的update-ca-certificates命令没有给我任何警告。
这可能是也可能不是一个特定版本的curl问题,所以这里是我的版本,只是为了完整性:
curl --version
# curl 7.51.0 (x86_64-alpine-linux-musl) libcurl/7.51.0 OpenSSL/1.0.2j zlib/1.2.8 libssh2/1.7.0
# Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
# Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets
解决这个错误的最快方法是在curl请求中添加-k选项。该选项“允许连接到SSL引用而不需要证书”。(来自curl—help)
请注意,这可能意味着您并没有与您认为您正在与之通信的端点通信,因为它们正在提供一个没有由您信任的CA签名的证书。
例如:
$ curl -o /usr/bin/apt-cyg https://raw.github.com/cfg/apt-cyg/master/apt-cyg
给我以下错误响应:
curl: (77) error setting certificate verify locations:
CAfile: /usr/ssl/certs/ca-bundle.crt
CApath: none
我加了-k
curl -o /usr/bin/apt-cyg https://raw.github.com/cfg/apt-cyg/master/apt-cyg -k
并且没有错误消息。作为奖励,现在我已经安装了apt-cyg。和ca证书。
这对我很有效
sudo apt-get install ca-certificates
然后进入证书文件夹
sudo cd /etc/ssl/certs
然后复制ca-certificates。CRT文件进入/etc/pki/tls/certs
sudo cp ca-certificates.crt /etc/pki/tls/certs
如果没有“tls/certs”文件夹,请创建一个“tls/certs”文件夹,并使用chmod 777 -R folderNAME修改权限
在git bash中运行以下命令,这对我来说很好
git config --global http.sslverify "false"