2011-08-17 100 views
21

寶石我有麻煩捆綁從git的私有倉庫的寶石:包:安裝私人的github倉庫

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

我也嘗試做一些混帳克隆my_private_repo,它的問我,我的帳戶密碼。這是正常的,它應該看看我的SSH配置,看看我已經有權訪問。 可能是重點,但我不知道如何在這個問題上進一步挖掘...

回答

26

使用「SSH」或「HTTP」URL到您的私人回購。例如:

# HTTP (I've found this to be more reliable) 
gem 'test', :git => 'https://[email protected]/my_account/test.git' 
# SSH 
gem 'test', :git => '[email protected]:my_account/test.git' 

不要猜測它們。您可以通過轉到您的github回購頁面來獲取它們......頂部有三個選項。

如果詢問輸入密碼是正常的。

+0

前工作過,後者沒有,很好的提示 –

+0

的SSH URL工作對我來說,至少在局部添加此。應該很有趣,讓這個工作在CI和其他一切。謝謝:) –

+0

在Mac上,錯誤可能很奇怪,對於我在終端窗口中運行git clone命令顯示實際錯誤。 git clone https://github.com/alexdunae/validates_email_format_of.git 同意Xcode/iOS許可證需要管理員權限,請通過sudo以root身份重新運行。 –

-2

在〜/的.gitconfig

[url "https://"] 
    insteadOf =git://