Elena' s AI Blog

Git Failed to Push Some Refs

05 Jun 2023 (updated: 17 Aug 2026) / 17 minutes to read

Elena Daehnhardt


Midjourney, July 2023

If you click an affiliate link and subsequently make a purchase, I will earn a small commission at no additional cost (you pay nothing extra). This is important for promoting tools I like and supporting my blogging.

I thoroughly check the affiliated products' functionality and use them myself to ensure high-quality content for my readers. Thank you very much for motivating me to write.



TL;DR:
  • Solutions for Git push errors when branch is behind: integrating remote changes with git pull, handling fast-forward merges, and resolving branch synchronization issues.

Previous: Part 11 — Preserve your local changes on Git Pull

Next: Part 17 — I have cloned my git repository and landed on main. How to get your branch

Why Git Reports “failed to push some refs”

The “failed to push some refs” error is Git’s way of refusing a git push because your local branch is behind its remote counterpart: the remote has commits you don’t have locally, so Git asks you to integrate those changes first. This post explains why this non-fast-forward rejection occurs and provides three reliable solutions, including fast-forwards, to push your updates to the remote repository.

The Problem - failed to push some refs

So, what does the “failed to push some refs to” error message mean? This error occurs when you try to push your changes to a remote repository, but Git refuses to do so because your local branch is behind the remote branch. Git is telling you that there are changes on the remote branch that you don’t have on your local branch, and it wants you to update your local branch first before pushing your changes.

This error message can be frustrating, especially when you’re confident your changes will be OK with the remote branch. However, Git has a good reason for preventing you from pushing your changes - it wants to ensure that all changes are merged correctly and that no conflicts arise.

That issue occurred after I was away from my big MAC computer and did some repository updates using my laptop. When arriving back, I could not push an update from my big MAC computer. Git updates were rejected because my current branch is behind. That happens quite often when we should integrate the remote changes before pushing git updates. Herein I am sharing possible solutions in detail.

git push origin master

The outcome was not nice:

 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:user/repo'
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.

How to Fix the “failed to push some refs” Error in Git

🔒 Subscribe to keep reading.

Conclusion: Resolving the “failed to push some refs” Error

🔒 Subscribe to keep reading.

References

🔒 Subscribe to keep reading.

Subscribe to unlock the full article ❤️

I keep most of the site completely open. A few unusually detailed tutorials need a free subscriber login so I can keep publishing this kind of work.

The form below signs you up for the newsletter. It does not log you into the app — log in afterwards (same email) to unlock this article and download your subscriber gifts. New subscribers get an inbox mail: Set a password to unlock articles.

desktop bg dark

About Elena

Elena, a PhD in Computer Science, simplifies AI concepts and helps you use machine learning.

Citation
Elena Daehnhardt. (2023) 'Git Failed to Push Some Refs', daehnhardt.com, 05 June 2023. Available at: https://daehnhardt.com/blog/2023/06/05/git-updates-were-rejected-current-branch-is-behind/
All Posts