我正在使用Aptana Studio 3和Heroku进行RoR网站项目.当我通过GitHub'提交'后将我的网站推送到Heroku时,我不断收到此错误.已到处搜索,但无法找到我可以遵循的简单解决方案.有什么建议发生了什么以及如何重新开始?谢谢.
User$ git push heroku master
To git@heroku.com:xxxxxx.git
! [rejected] master -> master (non-fast forward)
error: failed to push some refs to 'git@heroku.com:xxxxxx.git'
To prevent you from losing history, non-fast-forward updates were rejected.
Merge the remote changes before pushing again.
See 'non-fast forward' section of 'git push --help' for details.
User$
Run Code Online (Sandbox Code Playgroud)
我在@SkillDrick下面尝试了这个建议,并在最后加上错误:
User$ git merge heroku/master master
usage: git merge [options] <remote>...
or: git merge [options] <msg> HEAD <remote>
-n do not show a diffstat at the end of the merge
--stat show a diffstat at the end of the merge
--summary (synonym to --stat)
--log add list of one-line log to merge commit message
--squash create a single commit instead of doing a merge
--commit perform a commit if the merge succeeds (default)
--ff allow fast forward (default)
-s, --strategy <strategy>
merge strategy to use
-m, --message <message>
message to be used for the merge commit (if any)
-v, --verbose be more verbose
-q, --quiet be more quiet
user$ git push heroku master
To git@heroku.com:worrybin.git
! [rejected] master -> master (non-fast forward)
error: failed to push some refs to 'git@heroku.com:worrybin.git'
To prevent you from losing history, non-fast-forward updates were rejected.
Merge the remote changes before pushing again.
See 'non-fast forward' section of 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
我遇到过同样的问题.一个非常简单的解决方案是强制推动:
git push heroku master -f
由于heroku只是用于部署你的应用程序(而不是像源/主机这样的源代码控制),这应该没问题.
出于某种原因,你的Heroku回购已经分道扬.. 你可以这样做:
git fetch heroku
git merge heroku/master
git push heroku master
Run Code Online (Sandbox Code Playgroud)
这将"在再次推动之前合并远程变化".在合并之前,也许git diff heroku/master可以找出实际上不同的东西.