[英]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.