我做了什么sudo gem install cocoapods
这是来自终端的完整消息
ERROR: You must add /C=BE/O=GlobalSign nv-sa/CN=AlphaSSL CA - SHA256 - G2 to your local trusted store
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - hostname "rubygems.org" does not match the server certificate (https://rubygems.org/specs.4.8.gz)
ERROR: SSL verification error at depth 0: unable to get local issuer certificate (20)
我没有使用 SSL 的经验,但我遵循了几个与我类似的问题,但没有运气我试过的:
最佳答案
MichaelHuelsen 有正确的答案。在这里,我将给出对我有用的分步说明,但会用一个大文件覆盖 pem 文件,因此请注意,如果其中包含您可能不想破坏的敏感信息。
$ ruby -ropenssl -e 'p OpenSSL::X509::DEFAULT_CERT_FILE'
"/etc/pki/tls/cert.pem"
告诉我我的证书文件在哪里。cp /etc/pki/tls/cert.pem /tmp/cert.pem.bak
见:https://curl.se/docs/caextract.html
curl --remote-name --time-cond cacert.pem https://curl.se/ca/cacert.pem
mv cacert.pem /etc/pki/tls/cert.pem
然后我跑了gem update --system
更新内容,但您可以运行您原来的 gem
命令。
关于ruby - 安装 cocoapods 时出现 SSL 验证错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64038618/