问题描述
我正在尝试将代码从应用程序更新到存储库,并出现错误.
我该如何解决?
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.
此错误意味着Heroku上的master
分支包含本地分支中不是的提交.
您可以从Heroku中提取丢失的提交,然后将它们合并到本地副本中:
git pull heroku master
或者,如果您不关心丢失的提交,则可以强制推送到Heroku.这将使用您的本地提交覆盖Heroku上的远程仓库.
git push --force heroku master
确保您真的不关心它们,因为这样做会导致您从Heroku中失去它们.通常这并不重要,因为Heroku通常不是规范的仓库,例如GitHub.
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.
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.
这篇关于'Git push heroku master'命令出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!