git pull &&& git push
.git push origin master:foo
and merge it on remote repo.-f
(denyCurrentBranch
needs to be ignored).Basically the error means that your repository is not up-to-date with the remote code (its index and work tree is inconsistent with what you pushed).
Normally you should pull
first to get the recent changes and push
it again.
If won't help, try pushing into different branch, e.g.:
git push origin master:foo
then merge this branch on the remote repository back with master.
If you changed some past commits intentionally via git rebase
and you want to override repo with your changes, you probably want to force the push by adding -f
/--force
parameter (not recommended if you didn't do rebase
). If still won't work, you need to set receive.denyCurrentBranch
to ignore
on remote as suggested by a git message via:
git config receive.denyCurrentBranch ignore