“Git push heroku master”命令出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21087929/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 17:33:59  来源:igfitidea点击:

Error with 'Git push heroku master' command

githerokugithub

提问by Antonio Morales

I am trying to update the code from my application to my repository and an error appears.

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

How can I fix it?

我该如何解决?

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

回答by jordelver

This error means that the masterbranch on Heroku contains commits that are notin your local branch.

此错误意味着masterHeroku上的分支包含不在本地分支中的提交。

You can either pull the missing commits from Heroku and merge them into your local copy:

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

git pull heroku master

Or, if you don't care about the missing commits you can force push to Heroku. This will overwrite the remote repo on Heroku with your local commits.

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

git push --force heroku master

Make sure you really don't care about them as you will lose themfrom Heroku by doing this. Normally this doesn't matter as Heroku is not normally the canonical repo, somewhere else such as GitHub is.

确保你真的不关心它们,因为这样做你会从 Heroku失去它们。通常这并不重要,因为 Heroku 通常不是规范的 repo,而在其他地方,例如 GitHub。