将 Rails App 推送到 Heroku 时出错

发布于 2024-10-08 14:05:53 字数 1645 浏览 2 评论 0原文

我一直在浏览railstutorial.org,试图部署我的第一个rails应用程序,并且一直在绞尽脑汁地试图弄清楚所有的设置内容。这一切都应该是一键式的事情,更新到最新的 ruby​​/最新的 Rails,设置 git,然后你就可以开始了,但这是一个巨大的头痛。抱歉我不得不发泄一下。

当我在测试应用程序first_app的当前目录中尝试推送到heroku时,出现错误:

XXXXXX-Computer:first_app XXXXXX$ git push heroku master
fatal: The remote end hung up unexpectedly

搜索错误导致我https://git.wiki.kernel.org/index.php/GitFaq#Git_push_fails_with_.22fatal:_The_remote_end_hung_up_unexpectedly.22.3F 这表明我的公钥可能未正确安装。我已经能够很好地推送到 git 存储库,并检查我的 heroku 密钥,按预期吐出我的公钥:

XXXXXX-Computer:first_app XXXXXX$ heroku keys
=== 1 key for [email protected]
ssh-rsa AAAAB3NzaC...u4iGALvQ== [email protected]

我与教程的唯一偏差是我正在使用 ruby​​ 1.8.7/rails 3.03,因为我遇到了一些问题ruby 版本管理器 rvm。我可以将 ruby​​ 更新到 1.9.2,但是当我去检查 Rails 版本时,我得到了这个:

XXXXXX-Computer:first_app XXXXXX$ rails -v
/Library/Ruby/Site/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)

from /Library/Ruby/Site/1.8/rubygems.rb:214:in activate' 来自 /Library/Ruby/Site/1.8/rubygems.rb:1082:ingem' 来自 /usr/bin/rails:18

这也是我第一次使用 git 和 rvm,所以如果这是一个基本问题,我很抱歉。我已经尝试了一段时间,但在这本应该是简单的事情上并没有取得太大进展。我真的很感谢 stackoverflow 的集体智慧可以提供的任何帮助。先感谢您。

I've been walking through railstutorial.org trying to deploy my first rails app and have been banging my head trying to figure out all the setup stuff. This should all really be a one-click thing, update to newest ruby/newest rails, setup git and you're good to go, but it's a HUGE headache. Sorry I had to vent.

My error comes when I try to push to heroku while I'm in the current directory of my test app first_app:

XXXXXX-Computer:first_app XXXXXX$ git push heroku master
fatal: The remote end hung up unexpectedly

Searching the error led me to https://git.wiki.kernel.org/index.php/GitFaq#Git_push_fails_with_.22fatal:_The_remote_end_hung_up_unexpectedly.22.3F
which suggests that my public key may not be installed correctly. I have been able to push to a git repo fine and checking my heroku keys spits out my public key as expected:

XXXXXX-Computer:first_app XXXXXX$ heroku keys
=== 1 key for [email protected]
ssh-rsa AAAAB3NzaC...u4iGALvQ== [email protected]

My only deviation from the tutorial is that I'm using ruby 1.8.7/rails 3.03 because I was having some trouble with ruby version manager rvm. I could update ruby to 1.9.2, but when I went to check the rails version, I got this:

XXXXXX-Computer:first_app XXXXXX$ rails -v
/Library/Ruby/Site/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)

from /Library/Ruby/Site/1.8/rubygems.rb:214:in activate'
from /Library/Ruby/Site/1.8/rubygems.rb:1082:in
gem'
from /usr/bin/rails:18

This is my first time using git and rvm as well, so I apologize if it's a basic question. I've been trying at this for a while and haven't been making that much progress for what should be a simple thing. I really appreciate any help the collective genius of stackoverflow can offer. Thank you in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

呆头 2024-10-15 14:05:53

Heroku 会告诉你这是否是一个关键问题。该错误听起来更像是 git/网络问题。

Heroku 有时会出现推送问题,您可以在此处进行监控:http://status.heroku.com/。当这种情况发生时,您所能做的就是等待并稍后再试。

它也可能是您的 heroku 遥控器的配置。您可以发布 git remote show heroku 的输出来确定吗?

至于升级,应该不会影响你这里。 Gems 特定于您安装它们的 ruby​​ 版本,因此如果您升级到 1.9,则必须重新安装 gems。这就是为什么 Rails 在 1.9 上出现错误。

Heroku would tell you if it were a key issue. That error sounds more like a git/network issue.

Heroku occasionally has issues with pushing, which you can monitor here: http://status.heroku.com/. When it happens, all you can do is wait and try again later.

It could also be your config for the heroku remote. Could you post the output of git remote show heroku to be sure?

As for upgrading, it shouldn't affect you here. Gems are specific to the version of ruby you installed them for so if you upgrade to 1.9 you'll have to reinstall your gems. That's why rails had an error on 1.9.

Bonjour°[大白 2024-10-15 14:05:53

所以......在任何教程中都没有真正建议它,但是从终端登录到heroku解决了seg错误问题并启动了我的应用程序:

heroku login
  Email: ******
  Password: ******

git push heroku master

耶!

So...nothing really suggested it in any of the tutorials, but logging into heroku from the terminal solved the seg fault problem and got my app up:

heroku login
  Email: ******
  Password: ******

git push heroku master

Yay!

萌逼全场 2024-10-15 14:05:53

似乎您无法在注释中添加代码片段,并且新行也不是使用回车键完成的。这种情况以及现在较慢的连接可能导致我向您发送多封电子邮件通知。

无论如何,感谢您对宝石错误的回复和澄清。 的输出

heroku
origin

这是 git remote show:和 git remote show heroku:

fatal: The remote end hung up unexpectedly

相同的错误。

如果有帮助的话,我只是 cd 到该目录并检查我的 .git/config 文件并看到:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[remote "origin"]
    url = [email protected]:XXXXXX/first_app.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[remote "heroku"]
    url = [email protected]:stark-galaxy-XXX.git
    fetch = +refs/heads/*:refs/remotes/heroku/*

检查heroku信息:

XXXXXX-Computer:first_app XXXXXX$ heroku info
=== stark-galaxy-XXX
Web URL:        http://stark-galaxy-XXX.heroku.com/
Git Repo:       [email protected]:stark-galaxy-XXX.git
Dynos:          1 
Workers:        0
Stack:          bamboo-ree-1.8.7
Addons:         Shared Database 5MB
Owner:          [email protected]

我只是尝试删除我的应用程序,卸载heroku,然后重试。我按照 http://docs.heroku 手动更新了 git 远程.com/renaming-apps#manually-updating-a-git-remote

XXXXXX-Computer:first_app XXXXXX$ git remote rm heroku
XXXXXX-Computer:first_app XXXXXX$ git remote add heroku [email protected]:quiet-mountain-XXX.git

并检查它是由以下人员添加的:

XXXXXX-Computer:first_app XXXXXX$ git remote -v
heroku [email protected]:quiet-mountain-XXX.git (fetch)
heroku [email protected]:quiet-mountain-XXX.git (push)
origin [email protected]:XXX/first_app.git (fetch)
origin [email protected]:XXX/first_app.git (push)

但继续获取:

XXXXXX-Computer:first_app XXXXXX$ git remote show heroku
fatal: The remote end hung up unexpectedly

XXXXXX-Computer:first_app XXXXXX$ git push heroku master
fatal: The remote end hung up unexpectedly

It seems that you cannot add code snippets in comments and that new lines are not done with the enter key. That and a slower connection right now may have caused me to send you multiple email notifications.

Anyways, thank you for your response and clarification about the gems error. Here is the ouput of git remote show:

heroku
origin

and git remote show heroku:

fatal: The remote end hung up unexpectedly

The same error.

If it helps at all, I just cd'd to that directory and checked my .git/config file and saw:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[remote "origin"]
    url = [email protected]:XXXXXX/first_app.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[remote "heroku"]
    url = [email protected]:stark-galaxy-XXX.git
    fetch = +refs/heads/*:refs/remotes/heroku/*

Checking heroku info:

XXXXXX-Computer:first_app XXXXXX$ heroku info
=== stark-galaxy-XXX
Web URL:        http://stark-galaxy-XXX.heroku.com/
Git Repo:       [email protected]:stark-galaxy-XXX.git
Dynos:          1 
Workers:        0
Stack:          bamboo-ree-1.8.7
Addons:         Shared Database 5MB
Owner:          [email protected]

I just tried deleting my app, uninstalling heroku, then trying again. I manually updated a git remote as per http://docs.heroku.com/renaming-apps#manually-updating-a-git-remote:

XXXXXX-Computer:first_app XXXXXX$ git remote rm heroku
XXXXXX-Computer:first_app XXXXXX$ git remote add heroku [email protected]:quiet-mountain-XXX.git

And checked that it was added by:

XXXXXX-Computer:first_app XXXXXX$ git remote -v
heroku [email protected]:quiet-mountain-XXX.git (fetch)
heroku [email protected]:quiet-mountain-XXX.git (push)
origin [email protected]:XXX/first_app.git (fetch)
origin [email protected]:XXX/first_app.git (push)

but continue to get:

XXXXXX-Computer:first_app XXXXXX$ git remote show heroku
fatal: The remote end hung up unexpectedly

XXXXXX-Computer:first_app XXXXXX$ git push heroku master
fatal: The remote end hung up unexpectedly
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文