如何使用'gem install'命令从私有GitHub repo安装gem [英] How to install gem from private GitHub repo using 'gem install' command

查看:309
本文介绍了如何使用'gem install'命令从私有GitHub repo安装gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



特别是,我们通过一个来安装gem,



我试过这样做:

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

而且:

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

没有成功...我只是得到一个404包含以下内容的消息:

 错误:无法找到有效的gem'githubname-repo'(> = 0)原因:
无法从https://github.com/githubname/repo.git/下载数据 - 错误的响应未找到404(https://github.com/githubname/repo.git/latest_specs.4.8。 gz)

谢谢!

解决方案

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

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

我认为这可能适用于rubygems。



更新



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


  1. 克隆私人回购站点并构建源代码。

  2. 通过bundler安装,您可以设置github repo并设置网址,就像我的第一个答案。

  3. 使用私人宝石服务器,如 https://gemfury.com/l/gem-server 或设置您自己的服务器 http://guides.rubygems.org/command-reference/#gem-server


How do I install a gem locally that is hosted in a private repo on GitHub?

In particular, we are installing it via a gem install command rather than using in Bundler since it is a command line tool.

I tried doing this:

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

And this:

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

Without success... I just get a 404 message with both:

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)

Thanks!

解决方案

In HTTPS, the basic authentication params in URL need to be set like

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

I think this may work for rubygems.

Update

Your problem is different, the -s flag indicate a gem server, so if you like to distribute and install a private gem, you have 3 options

  1. Clone the private repo and build the sources wit gem build ..
  2. Install via bundler, you can set the github repo and set the url like my first answer.
  3. Use a private gem server like https://gemfury.com/l/gem-server or setup your own server http://guides.rubygems.org/command-reference/#gem-server

这篇关于如何使用'gem install'命令从私有GitHub repo安装gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆