git push – rejected non-fast-forward

When trying to do a push to a repo, you might encounter the following error:

# git push origin
key_from_blob: remaining bytes in key blob 1169
To ssh://[email protected]/username/your_repo.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://[email protected]/username/your_repo.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.

That’s an easy fix. Just issue a pull like so:

# git pull origin
key_from_blob: remaining bytes in key blob 1169
remote: Counting objects: 36, done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 30 (delta 20), reused 0 (delta 0)
Unpacking objects: 100% (30/30), done.
From ssh://
   79310d0..78ba14a  master     -> origin/master
First, rewinding head to replay your work on top of it...
Applying: adding screenshot
# git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
nothing to commit (working directory clean)