When Git tells you it failed to push some refs

I received an unhelpful error while trying to push to a repository on Github today:

git push
To git@github.com:user/repo.git
! [rejected] branchname -> branchname (non-fast forward)
error: failed to push some refs to 'git@github.com:user/repo.git'
git push
To git@github.com:user/repo.git
! [rejected] branchname -> branchname (non-fast forward)
error: failed to push some refs to 'git@github.com:user/repo.git'

In case you ever have the same problem, all you have to do is a quick git pull first, then you can carry on as normal. Easy when you know how...

Share Post:

What to Read Next