【问题标题】:I get an error when running "git push heroku master"运行“git push heroku master”时出现错误
【发布时间】:2021-03-30 16:46:33
【问题描述】:

按照heroku官方说明如何部署应用程序后,我运行了“git push heroku master”,但出现以下错误:

To https://git.heroku.com/miguelangelparedes.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/miguelangelparedes.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

奇怪的是,在我运行“git pull”之后,它说一切都是最新的,当我再次推送时,我得到了同样的错误。如果有人帮忙就好了

【问题讨论】:

    标签: javascript heroku


    【解决方案1】:

    Heroku 应用程序仅在应用程序存储库的主分支(Heroku 本地)之外运行。如果你想将一个分支部署到 Heroku,它不是你本地 repo 的主分支,那么你需要指定它 试试 git push my-branch-name:master ! 您可能需要添加 -f 标志来强制推送。

    【讨论】:

      【解决方案2】:
      • 先运行git pull,然后再次尝试推送。
      • 如果您是唯一使用此存储库的人,并且您绝对确定您的版本是正确的,您也可以git push -f,但这会覆盖服务器的版本,所以您必须非常小心。

      【讨论】:

      • @azidikk,如果对您有帮助,请接受并投票赞成我的回答:)
      猜你喜欢
      • 2019-08-01
      • 1970-01-01
      • 2013-02-03
      • 2016-12-26
      • 1970-01-01
      • 2018-01-13
      • 2016-02-19
      • 1970-01-01
      • 2014-02-01
      相关资源
      最近更新 更多