Bundle:从私有github存储库安装gem

时间:2011-08-17 14:39:33

标签: ruby-on-rails-3 github gem bundler private

我无法从git私有存储库捆绑gems:

gem 'test', :git => 'git://github.com/my_account/test.git'

myapp_folder$ bundle --verbose
Fetching git://github.com/my_account/test.git
fatal: The remote end hung up unexpectedly
Git error: command `git clone 'git://github.com/my_account/test.git' "/Library/Ruby/Gems/1.8/cache/bundler/git/test-7b1f0bd821d503c9d6d421d89c56850dad44c15a" --bare --no-hardlinks` in directory /Users/.../myapp_forlder has failed.
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:583:in `git'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:652:in `cache'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:550:in `specs'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:356:in `converge_locked_specs'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:345:in `each'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:345:in `converge_locked_specs'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:143:in `resolve'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:90:in `specs'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/definition.rb:85:in `resolve_remotely!'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:43:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:8:in `install'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/cli.rb:220:in `install'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `send'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor.rb:263:in `dispatch'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/base.rb:386:in `start'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.18/bin/bundle:13
/usr/bin/bundle:19:in `load'
/usr/bin/bundle:19

它完全适用于推/拉/私有克隆它自己。

它与捆绑我的公共github存储库完美配合。

我在Mac OS上使用捆绑包v 1.0.18

我也尝试制作一些git clone my_private_repo,它会问我我的帐户密码。这是正常还是它应该看我的ssh配置,看看我已经有权访问。 可能是重点,但我不知道如何在这个问题上进一步挖掘......

2 个答案:

答案 0 :(得分:26)

使用“SSH”或“HTTP”网址到您的私人仓库。例如:

# HTTP (I've found this to be more reliable)
gem 'test', :git => 'https://my_account@github.com/my_account/test.git'
# SSH
gem 'test', :git => 'git@github.com:my_account/test.git'
但是,不要猜测它们。你可以通过你的github repo页面来获取它们......顶部有三个选项。

如果要求输入密码是正常的。

答案 1 :(得分:-2)

在〜/ .gitconfig

中添加
[url "https://"]
   insteadOf =git://