简体   繁体   English

无法验证 https://rubygems.org/ 的 SSL 证书

[英]Could not verify the SSL certificate for https://rubygems.org/

I'm getting this error when I run bundle install :运行bundle install时出现此错误:

Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely 
your system doesn't have the CA certificates needed for verification. For
information about OpenSSL certificates, see bit.ly/ruby-ssl. To connect without using 
SSL, edit your Gemfile sources and change 'https' to 'http'.

However, it is only happening to one of my projects, and seems to be happening to only me.然而,它只发生在我的一个项目上,而且似乎只发生在我身上。 Also, I can get around it by running bundle update , where I don't get that error, and I can get up a running after that.此外,我可以通过运行bundle update来解决它,在那里我没有收到该错误,然后我可以开始运行。

Is there something that isn't tracked in the project (that is only on my machine) that I have misconfigured?我配置错误的项目(仅在我的机器上)中是否有未跟踪的内容?

I had this problem on Mac OS X Yosemite with ruby 2.3.1.我在带有 ruby​​ 2.3.1 的 Mac OS X Yosemite 上遇到了这个问题。 I fixed the problem by downloading http://curl.haxx.se/ca/cacert.pem to /usr/local/etc/openssl/我通过将http://curl.haxx.se/ca/cacert.pem下载到/usr/local/etc/openssl/解决了这个问题

and adding this line export SSL_CERT_FILE=/usr/local/etc/openssl/cacert.pem to .bash_profile并添加这一行export SSL_CERT_FILE=/usr/local/etc/openssl/cacert.pem.bash_profile

Credit to Can't run Ruby 2.2.3 with RVM on OSX but it was hard to google the right answer, so added to this page.归功于Can't run Ruby 2.2.3 with RVM on OSX但很难在谷歌上找到正确的答案,所以添加到这个页面。

The solution for me on OS X 10.9.5 was to sudo rvm osx-ssl-certs update all .我在 OS X 10.9.5 上的解决方案是sudo rvm osx-ssl-certs update all

Source: http://jacopretorius.net/2013/10/could-not-verify-the-ssl-certificate-for-rubygems.html来源: http : //jacopretorius.net/2013/10/could-not-verify-the-ssl-certificate-for-rubygems.html

运行gem update --system为我工作

Since I am using rbenv instead of rvm , I wasn't able to do most of the solutions online.由于我使用的是rbenv而不是rvm ,因此我无法在线完成大部分解决方案。

I was able to fix the issue by uninstalling and reinstalling openssl我能够通过卸载并重新安装openssl来解决这个问题

All is well, but I am not exactly sure why.一切都很好,但我不确定为什么。

对于 linux 用户,只需安装软件包: ca-certificates

升级 openssl 应该可以解决这个问题。(如果是 MacOSX)

brew upgrade openssl

使用 OSX 10.14.6和 Rails 6 这对我10.14.6

rvm osx-ssl-certs update

Maybe this method will be useful也许这个方法会有用

1.Switch source to https://gems.ruby-china.org/ 1.切换源码到https://gems.ruby-china.org/

$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/

2.Check current source 2.检查电流源

$ gem sources -l

*** CURRENT SOURCES ***

https://gems.ruby-china.org

3.Mirror gem source 3.镜像宝石来源

$ bundle config mirror.https://rubygems.org https://gems.ruby-china.org

Through these methods, you will not need to change Gemfile souce .通过这些方法,您将不需要更改Gemfile souce

Hope this method will be useful for you.希望这个方法对你有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “无法从https://rubygems.org/下载数据”,因为“证书验证失败” - “Unable to download data from https://rubygems.org/” because “certificate verify failed” 使用http://rubygems.org而不是https时,“证书验证失败” - “Certificate verify failed” while using http://rubygems.org instead of https https://rubygems.org/不是URI - https://rubygems.org/ is not a URI 捆绑安装无法从 https://rubygems.org/ 获取规范 - Bundle Install could not fetch specs from https://rubygems.org/ gem mongoid:无法从https://rubygems.org/获取规格 - gem mongoid : Could not fetch specs from https://rubygems.org/ 无法从https://rubygems.org/获取规范 - Could not fetch specs from https://rubygems.org/ SSL 安装 rubygems 时出错,无法从“https://rubygems.org/”提取数据 - SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/ 是否可以验证 Gemfile.lock 中的所有宝石是否存在于 https://rubygems.org? - Is it possible to verify if all gems in a Gemfile.lock exist at https://rubygems.org? gemspec不允许使用“ https://rubygems.org”,而只能使用“'http://rubygems.org'” - “https://rubygems.org” is not allowed by the gemspec, which only allows “'http://rubygems.org'” 未定义的方法规范:“https://rubygems.org”:符号 - undefined method specs for :“https://rubygems.org”:Symbol
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM