gitgit-bare

Pushing to a bare repository is rejected due to current branch behind remote counterpart


I created a bare repository on One Drive disk space in order to save my temporary branches/work before pushing to the central git repository. Reason why is working on an unstable virtual machine. So basically I'm using two origin, one for the central repo, one for the bare one. I'm the only one pushing on the "onedrive" origin, but sometime I receive:

hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Since no one pushed on that remote but me, I can't understand how can my branch being "behind" that remote. What am I missing?


Solution

  • I managed to find the issue, that is not related to file syncing ore some other tricky stuff, but is quite clear until you got it. First of all I save all the branches on my backup bare repository. Sometimes I do a rebase of some of my local brances ( local in rrespect to the origin repository ) and here why the push on the backup fails. So I have basically to use push -f to force these situation to be pushed as well.