带有 git remote 的 Gem 文件在 heroku 推送上失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11557759/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 07:14:42  来源:igfitidea点击:

Gem file with git remote failing on heroku push

ruby-on-railsrubygitherokubundler

提问by Dom Barker

I have the following line in my gemfile:

我的 gemfile 中有以下行:

gem 'client_side_validations', :git => "[email protected]:Dakuan/client_side_validations.git", :branch => "master", ref: '2245b4174ffd4b400d999cb5a2b6dccc0289eb67'

The repo it's pointing at is public and I can run bundle install / update locally just fine. When I try to push to Heroku I get the following error:

它指向的存储库是公开的,我可以在本地运行 bundle install/update 就好了。当我尝试推送到 Heroku 时,出现以下错误:

   Fetching [email protected]:Dakuan/client_side_validations.git
   Host key verification failed.
   fatal: The remote end hung up unexpectedly
   Git error: command `git clone '[email protected]:Dakuan/client_side_validations.git' "/tmp/build_1xa9f06n4k1cu/vendor/bundle/ruby/1.9.1/cache/bundler/git/client_side_validations-56a04875baabb67b5f8c192c6c6743df476fd90f" --bare --no-hardlinks` in directory /tmp/build_1xa9f06n4k1cu has failed.

! ! Failed to install gems via Bundler. ! ! Heroku push rejected, failed to compile Ruby/rails app

   Fetching [email protected]:Dakuan/client_side_validations.git
   Host key verification failed.
   fatal: The remote end hung up unexpectedly
   Git error: command `git clone '[email protected]:Dakuan/client_side_validations.git' "/tmp/build_1xa9f06n4k1cu/vendor/bundle/ruby/1.9.1/cache/bundler/git/client_side_validations-56a04875baabb67b5f8c192c6c6743df476fd90f" --bare --no-hardlinks` in directory /tmp/build_1xa9f06n4k1cu has failed.

!!无法通过 Bundler 安装 gem。!!Heroku 推送被拒绝,无法编译 Ruby/rails 应用程序

Anyone got any ideas about what's going on here?

有人对这里发生的事情有任何想法吗?

回答by georgebrock

Use this GitHub URL instead: git://github.com/Dakuan/client_side_validations.git

请改用此 GitHub URL: git://github.com/Dakuan/client_side_validations.git

The [email protected]:…URL is the writable SSH version, which requires authentication with an SSH key connected to a GitHub account that has write access to the repository.

[email protected]:…URL是可写的SSH版本,这就需要有连接到具有对存储库写入权限的帐户GitHub的一个SSH密钥认证。

The git://github.com/…URL is the public, read-only version.

git://github.com/…网址是公开的,只读版本。

Since the gem you're using is in a public GitHub repository, you can also use this shorthand in your Gemfile:

由于您使用的 gem 位于公共 GitHub 存储库中,因此您也可以在 Gemfile 中使用以下简写:

gem 'client_side_validations', :github => 'Dakuan/client_side_validations'

See the Bundler Git documentationfor more information.

有关更多信息,请参阅Bundler Git 文档

回答by Ben Hull

A late second answer, as I ran into some confusing output from Heroku's build logs which stumped me for a while.

第二个答案很晚,因为我从 Heroku 的构建日志中遇到了一些令人困惑的输出,这让我难住了一段时间。

If you have multiple Github hosted gems in your Gemfile, and one of them is inaccessible (in my case, I had accidentally pointed to a private repo of mine), the build logs throw an error like Username not foundor Repository not foundfor allthe Github hosted gems - even those that are available.

如果你有多个Github上托管的宝石在你的Gemfile,其中一人是无法访问(在我的情况,我不小心指着我的私人回购),生成日志抛出这样的错误Username not found或者Repository not found所有的Github上托管的宝石-甚至那些可用的。