【问题标题】:Error with 'Git push heroku master' command“Git push heroku master”命令出错
【发布时间】:2014-02-01 00:00:46
【问题描述】:

我正在尝试将代码从我的应用程序更新到我的存储库并出现错误。

我该如何解决?

C:\Sites\ecozap>git push heroku master
Enter passphrase for key '/c/Users/Diseño2/.ssh/id_rsa':
Fetching repository, done.
To git@heroku.com:ecozap.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:ecozap.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 heroku github


    【解决方案1】:

    此错误表示 Heroku 上的 master 分支包含不是在您的本地分支中的提交。

    您可以从 Heroku 中提取丢失的提交并将它们合并到您的本地副本中:

    git pull heroku master
    

    或者,如果您不关心丢失的提交,您可以强制推送到 Heroku。这将用您的本地提交覆盖 Heroku 上的远程仓库。

    git push --force heroku master
    

    确保您真的不在乎它们因为这样做会使 Heroku 失去它们。通常这无关紧要,因为 Heroku 通常不是规范的 repo,其他地方比如 GitHub 是。

    【讨论】:

      猜你喜欢
      • 2013-02-03
      • 2016-12-26
      • 1970-01-01
      • 2011-05-23
      • 2014-10-26
      • 1970-01-01
      • 1970-01-01
      • 2019-08-01
      • 2016-02-19
      相关资源
      最近更新 更多