使用提交的哈希值安装gem

问题描述 投票:0回答:1

我真的很简单Gemfile

source 'https://rubygems.org'                                                                                                                                                                                                                                                                                                                                                                                                   
gem 'stripe-ruby-mock', 
  github: 'mnin/stripe-ruby-mock', 
  require: 'stripe_mock', 
  ref: 'b6446fb5ae2b14b6703554cbea4ebd466e4f3c47'

当我运行bundle命令安装此gem时,出现此错误:

root@6bcff6bf3997:/app# bundle
The git source `git://github.com/mnin/stripe-ruby-mock.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
Fetching git://github.com/mnin/stripe-ruby-mock.git
fatal: Could not parse object 'b6446fb5ae2b14b6703554cbea4ebd466e4f3c47'.
Revision b6446fb5ae2b14b6703554cbea4ebd466e4f3c47 does not exist in the repository git://github.com/mnin/stripe-ruby-mock.git. Maybe you misspelled it?

但是我可以使用此链接https://github.com/mnin/stripe-ruby-mock/commit/b6446fb5ae2b14b6703554cbea4ebd466e4f3c47访问Github上的提交页面。

那么,我该如何使用此提交的哈希值作为gem?

ruby-on-rails ruby github rubygems bundler
1个回答
1
投票

无法从任何分支或标签到达该提交。因此,当您从GitHub克隆存储库时(Bundler在后台进行复制),您的本地副本将没有该提交。

因此,您不能使用它。

在GitHub上,您看不到此提交,因为它没有列出包含该提交的任何分支或标签:

enter image description here

与父提交进行比较,列出父提交可访问的列表:

enter image description here

请注意,孤立的提交最终会被Git收集到垃圾。 GitHub不会这样做,因为可能会引用特定的提交。


0
投票

如果可能,尽量不要使用叉形宝石。但是,如果您需要锁定一个分叉的版本,请确保您拥有该叉子。分叉分支的分支,将其合并到您自己的存储库的主分支,然后在您的gemfile中使用该存储库。

© www.soinside.com 2019 - 2024. All rights reserved.