【问题标题】:Getting error when trying to git push to remote branch (Heroku)尝试 git push 到远程分支时出错(Heroku)
【发布时间】:2013-02-28 12:08:30
【问题描述】:

您好,我尝试将本地更改推送到 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.

这里有什么问题,我该如何解决?

【问题讨论】:

    标签: heroku github git-push


    【解决方案1】:

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

    我恳请您不要将 Heroku 用作权威的 git 遥控器。假设你不是,你可以强制推送 Heroku master 分支来解决这个问题。

    git push -f heroku-production master:master
    

    【讨论】:

      猜你喜欢
      • 2012-08-09
      • 2013-03-19
      • 2015-07-31
      • 2012-01-05
      • 2016-04-25
      • 1970-01-01
      • 2016-04-12
      • 2015-08-27
      • 2017-04-25
      相关资源
      最近更新 更多