捆绑包:从私有 Github 存储库安装 gem

21

我在从Git私有存储库打包宝石方面遇到了麻烦:

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

使用 push/pull/无论是私有克隆本身都可以完美工作。

使用捆绑我的公共 Github 存储库也可以完美工作。

我使用的是 Mac OS,捆绑版本为 1.0.18。

我还尝试让一些人克隆我的私有存储库,但它要求我输入账户密码。这是正常的吗?或者它应该查看我的 ssh 配置,并查看我已经有访问权限。

也许这就是问题所在,但我不知道如何进一步挖掘这个问题。

2个回答

27
请使用SSH或HTTP URL访问您的私有代码库,例如:
# 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 仓库页面来获取它们……页面顶部有三个选项。

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


SSH URL 对我来说至少在本地工作。让它在 CI 和其他一切上工作起来应该会很有趣。谢谢 :) - Anthony Michael Cook
在 Mac 上,错误可能会很奇怪,对我来说,在终端窗口运行 git clone 命令显示了实际的错误。git clone https://github.com/alexdunae/validates_email_format_of.git同意 Xcode/iOS 许可协议需要管理员权限,请使用 sudo 重新运行。 - so_mv
有没有办法让git在pageant中查找密钥而不是手动输入?我已经在pageant中拥有了正确的密钥。但似乎bundle install会忽略它们。 - new2cpp

-2

将以下内容添加到您的~/.gitconfig文件中

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接