问题
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!
回答1:
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
- Clone the private repo and build the sources wit gem build ..
- Install via bundler, you can set the github repo and set the url like my first answer.
- 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
来源:https://stackoverflow.com/questions/26851390/how-to-install-gem-from-private-github-repo-using-gem-install-command