【发布时间】: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 分支。