gpt4 book ai didi

git - 如何使用 'gem install' 命令从私有(private) GitHub 仓库安装 gem

转载 作者:行者123 更新时间:2023-12-05 08:10:05 24 4
gpt4 key购买 nike

如何在本地安装托管在 GitHub 私有(private)存储库中的 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)

谢谢!

最佳答案

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

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

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

更新

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

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

关于git - 如何使用 'gem install' 命令从私有(private) GitHub 仓库安装 gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26851390/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com