Error with 'Git push heroku master' command

浪子不回头ぞ 提交于 2020-06-09 08:23:07

问题


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 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.

回答1:


This error means that the master branch on Heroku contains commits that are not in your local branch.

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

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.

git push --force heroku master

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.



来源:https://stackoverflow.com/questions/21087929/error-with-git-push-heroku-master-command

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!