error: failed to push some refs to ‘git@bitbucket.org

Just a reminder to myself:

git push origin master
Enter passphrase for key ‘/root/.ssh/id_rsa’:
To git@bitbucket.org:epp2k12/sample_app_server.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ‘git@bitbucket.org:epp2k12/sample_app_server.git’
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the ‘Note about
fast-forwards’ section of ‘git push –help’ for details.

Solution:

git push -f
or
git push origin +master

These will both ignore the check for a non-fast-forward push, and update what’s on the server to your new A’ revision, abandoning the A revision so it will eventually be garbage collected.

Up ↑

%d bloggers like this: