问题描述
我正在尝试将代码从我的应用程序更新到我的存储库,但出现错误.
I am trying to update the code from my application to my repository and an error appears.
我该如何解决?
C:Sitesecozap>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.
推荐答案
此错误意味着 Heroku 上的 master
分支包含不在您本地分支的提交.
This error means that the master
branch on Heroku contains commits that are not in your local branch.
您可以从 Heroku 中提取丢失的提交并将它们合并到您的本地副本中:
You can either pull the missing commits from Heroku and merge them into your local copy:
git pull heroku master
或者,如果您不关心丢失的提交,您可以强制推送到 Heroku.这将使用您的本地提交覆盖 Heroku 上的远程存储库.
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.
git push --force heroku master
确保你真的不关心它们因为这样做你会从 Heroku 失去它们.通常这无关紧要,因为 Heroku 通常不是规范的存储库,其他地方(例如 GitHub)才是.
Make sure you really don't care about them as you will lose them from Heroku by doing this. Normally this doesn't matter as Heroku is not normally the canonical repo, somewhere else such as GitHub is.
这篇关于“Git push heroku master"命令出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!