ruby使用国内的镜像操作方法

来源:互联网 发布:哪里有网络水军可以请 编辑:程序博客网 时间:2024/05/16 06:10

请尽可能用比较新的 RubyGems 版本,建议 2.6.x 以上。

$ gem update --system # 这里请翻墙一下$ gem -v2.6.3
$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/$ gem sources -lhttps://gems.ruby-china.org# 确保只有 gems.ruby-china.org
如果你使用 Gemfile 和 Bundler (例如:Rails 项目)

你可以用 Bundler 的 Gem 源代码镜像命令。

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

这样你不用改你的 Gemfile 的 source。

source 'https://rubygems.org/'gem 'rails', '4.2.5'...
原创粉丝点击