Skip to main content
X

Explore your training options in 10 minutes

Git Tutorials

Error: Failed To Push Some Refs To Remote

Christina Kopecky - October 14, 2020


When working with git, you may encounter various errors, especially when working on the same codebase with a team.

The Error Message

The error: failed to push some refs to remote git error occurs when new changes are pushed to the repository on version control not yet made it to your local repository. This could happen when you are working with someone on one project and simultaneously push to a branch.

Many times, git shows you hints on why updates are rejected ( hint: e.g. git pull… ). If the hints don’t work try this fix:

Get offers and scholarships from top coding schools illustration

Find Your Bootcamp Match

  • Career Karma matches you with top tech bootcamps
  • Access exclusive scholarships and prep courses










By continuing you agree to our Terms of Service and Privacy Policy , and you consent to receive offers and opportunities from Career Karma by telephone, text message, and email.

The Fix: git pull

We need to git pull before we push.

Try these steps to fix:

  1. git pull -rebase origin [master | main | other branch name]
  2. git push origin [master | main | other branch name]

Git pull combines git fetch and git merge into one command – it takes the remote changes from your remote branch and integrates them into your local branch. This is due to the --rebase option.

Some version control companies are in the process of changing their master branches to main branches – if your production branch is master, use master ; likewise, if your production branch is main, use main .

That’s all there is to it!

About us: Career Karma is a platform designed to help job seekers find, research, and connect with job training programs to advance their careers. Learn about the CK publication.

What's Next?

Christina Kopecky

About the author: Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.

Skip to main content