【问题标题】:How to install gem from private GitHub repo using 'gem install' command如何使用“gem install”命令从私有 GitHub 存储库安装 gem
【发布时间】:2014-11-10 19:25:21
【问题描述】:

如何在本地安装托管在 GitHub 上的私有存储库中的 gem?

特别是,我们通过gem install 命令安装它,而不是在 Bundler 中使用,因为它是一个命令行工具。

我试过这样做:

gem install githubname-repo -s https://github.com/githubname/repo.git

还有这个:

gem install repo -s https://github.com/githubname/repo.git

没有成功...我只收到一条 404 消息:

ERROR:  Could not find a valid gem 'githubname-repo' (>= 0), here is why:
      Unable to download data from https://github.com/githubname/repo.git/ - bad response Not Found 404 (https://github.com/githubname/repo.git/latest_specs.4.8.gz)

谢谢!

【问题讨论】:

    标签: git github gem


    【解决方案1】:

    在 HTTPS 中,URL 中的基本认证参数需要设置为

    https://user:password@github.com/username/repo.git
    

    我认为这可能适用于 ruby​​gems。

    更新

    你的问题不同,-s 标志表示一个 gem 服务器,所以如果你想分发和安装一个私有 gem,你有 3 个选项

    1. 克隆私有存储库并使用 gem build 构建源代码 ..
    2. 通过 bundler 安装,你可以设置 github repo 并像我的第一个答案一样设置 url。
    3. 使用像https://gemfury.com/l/gem-server这样的私有gem服务器或者设置你自己的服务器http://guides.rubygems.org/command-reference/#gem-server

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-28
    • 2019-11-09
    • 1970-01-01
    • 2011-06-17
    • 2011-02-04
    • 2011-04-20
    • 1970-01-01
    相关资源
    最近更新 更多