尝试向远程分支(Heroku)进行git push时出现错误

3

您好,我尝试将本地更改推送到Heroku生产环境,但出现以下错误:

Zhens-MacBook-Pro:Dailymuses-Server-Side zaikshev88$ git push heroku-production master:master
To git@heroku.com:dailymuses.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:dailymuses.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

问题在于当我尝试进行git pull时,提示我一切都是最新的

Zhens-MacBook-Pro:Dailymuses-Server-Side zaikshev88$ git pull origin master
From github.com:mingyeow/Dailymuses-Server-Side
* branch            master     -> FETCH_HEAD
Already up-to-date.

这里出现了什么问题,我该如何解决它?

1个回答

10

您的push命令是发往远程的heroku-production,但是您的pull命令是发往originnon-fast-forward消息意味着您当前仓库中的历史记录与Heroku远程不同;可能有人推送了一个带有一些合并或变基的分支。

我恳请您不要将Heroku设为git远程的权威来源。假设您没有这样做,您可以强制推送到Heroku主分支以解决此问题。

git push -f heroku-production master:master

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接