运行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'.
然而,它只发生在我的一个项目上,而且似乎只发生在自己身上。此外,我可以通过运行bundle update
来绕过它,在那里我不会出现错误,然后我可以开始运行。
项目中是否有未跟踪的内容(仅在我的机器上)是我配置错误的?
我在带有ruby 2.3.1的Mac OS X Yosemite上遇到了这个问题。我通过下载解决了这个问题http://curl.haxx.se/ca/cacert.pem到/usr/local/etc/openssl/
并将该行export SSL_CERT_FILE=/usr/local/etc/openssl/cacert.pem
添加到.bash_profile
信用给Can';我在OSX上用RVM运行Ruby 2.2.3,但很难在谷歌上找到正确的答案,所以添加到了这个页面。
我在OS X 10.9.5上的解决方案是sudo rvm osx-ssl-certs update all
。
来源:http://jacopretorius.net/2013/10/could-not-verify-the-ssl-certificate-for-rubygems.html
运行gem update --system
对我的有效
对于linux用户,只需安装包:ca-certificates
由于我使用的是rbenv
而不是rvm
,所以我无法在线完成大多数解决方案。
我能够通过卸载并重新安装openssl
来解决这个问题
一切都很好,但我不太清楚为什么。
升级openssl应该可以解决这个问题。(如果是MacOSX)
brew upgrade openssl
使用OSX 10.14.6
和Rails 6,这对我来说很有效:
rvm osx-ssl-certs update
也许这个方法对有用
1.将源切换到https://gems.ruby-china.org/
$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
2.检查电流源
$ gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.org
3.镜像宝石源
$ bundle config mirror.https://rubygems.org https://gems.ruby-china.org
通过这些方法,您将不需要更改Gemfile souce
。
希望这个方法对你有用。