【问题标题】:Git pushing to heroku rejected (non-fast-forward updates)Git推送到heroku被拒绝(非快进更新)
【发布时间】:2013-10-17 04:44:49
【问题描述】:

我尝试回到之前在 git 上的提交。现在我正试图把它推回heroku。

git push staging-heroku staging:master

To git@heroku.com:MyApp.git
 ! [rejected]        staging -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:MyApp.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

我搜索了 Stackoverflow,他们说

git push -f git@heroku.com:<heroku repo name>.git

我试过了,我得到了

Total 0 (delta 0), reused 0 (delta 0)


 !     Push rejected, no Cedar-supported app detected

To git@heroku.com:MyApp.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@MyApp.git'

更新

Winfield 建议检查我的 Procfile

cat Procfile

web: node app.js

git add Procfile 和 git push -f git@heroku.com:MyApp.git 给我同样的错误信息。

【问题讨论】:

  • 我猜你需要做出一个新的提交来撤销旧的更改并推送它。如果这不是微不足道的,你总是可以例如使用 git reparent 在任何其他提交之上添加您想要的提交的新副本。
  • 谢谢,鲁普!我会尝试更多地了解 reparent。
  • git 分支给了我开发、主控和登台。我可以只输入 git reparent staging 吗?我是否需要安装任何东西才能使 reparent 工作? Git 说它不是命令。
  • 哦,我不知道对不起。我知道 git,但我不知道 Heroku 如何设置它的 git 存储库,并且可能有一些我不太了解的魔法。我猜想以某种方式退出提交并正常推送,但我不知道这如何转化为 Heroku 分支。

标签: git node.js heroku


【解决方案1】:

您看到的当前错误是 Heroku Ruby buildpack 无法识别您的 git 存储库中的 Ruby 应用程序并与之集成。

这意味着您缺少以下一项或多项:

  • Gemfile 带有 gem depdencies 和 ruby​​ 版本
  • Procfile 运行一个或多个 ruby​​ 进程

【讨论】:

  • 谢谢。所以我需要使用 git add 将 Procfile 添加到当前提交中?我正在使用快速模板 + Node.JS
  • 我对原始问题添加了更新。谢谢你的帮助,温菲尔德! :)
猜你喜欢
  • 2011-10-17
  • 2013-12-26
  • 2011-06-08
  • 2012-08-27
  • 2017-01-09
  • 2021-09-22
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多