无法推送到 Heroku(非快进)[Rails]

Can't push to Heroku (non-fast-forward) [Rails]

我在将一些代码推送到 Heroku 时遇到问题。我仍在学习所有这些工具的工作原理,所以我将粘贴我刚刚所做的。

saasbook@saasbook:~/typo$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   db/db_development
#
no changes added to commit (use "git add" and/or "git commit -a")

saasbook@saasbook:~/typo$ git push origin
Username for 'https://github.com': FranGoitia
Password for 'https://FranGoitia@github.com': 
To https://github.com/FranGoitia/typo
   3b2d868..02c6eb1  master -> master
saasbook@saasbook:~/typo$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   db/db_development
#
saasbook@saasbook:~/typo$ git push heroku master
To https://git.heroku.com/still-ravine-4135.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/still-ravine-4135.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.
saasbook@saasbook:~/typo$ git push origin master
Username for 'https://github.com': FranGoitia
Password for 'https://FranGoitia@github.com': 
Everything up-to-date
saasbook@saasbook:~/typo$ git push heroku master
To https://git.heroku.com/still-ravine-4135.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/still-ravine-4135.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.
saasbook@saasbook:~/typo$ 

任何帮助将不胜感激。谢谢

git push origin master
To https://github.com/Joey-project/project.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/Joey-project/project.git'

之前在这里讨论过。这是一个常见的错误。

发生这种情况的一个主要原因是不应该将 his/her 分支推送到更新的远程分支。

如果我没记错的话,必须使用类似的东西:

git fetch origin; git merge origin/master

code push to heroku not working 可能会派上用场,其中有很多关于您的问题的额外信息。

很久以前用过heroku CLI,所以记不太清了,不过看样子应该是你没有fetch merge吧。

这可能是由于 heroku 中 git 文件的单独更改造成的。意思是,假设我在本地副本上工作,将其推送到原点(在 git) ,但是在执行此操作时,如果我对 heroku 上的 git 文件进行了更改,当您尝试推送时来自本地系统的新更改,将导致此错误。换句话说,流程是 disrupted.Git 变得混乱。它拒绝。

所以首先,从 heroku 获取合并(甚至不知道它是否可能,但应该是),然后如果有冲突,手动删除它们,现在代码有 heroku 更改,你最近的更改也趋于平稳,现在将它们推送到 heroku。它应该工作。