Error: failed to push some refs


#1

Tried 10 times, can't get it to work. I get this message every single time

error: failed to push some refs to 'https://github.com/leaoc/leaoc.github.io.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
$


#2

I got the same error. I only solved it by following one of those hints and doing git pull -u origin master before I tried to do what the instructions said, ( git push -u origin master)

It took me through slightly confusing steps where I had to add a comment on why I was merging things, and I had to CTRL +C to get out of the text editing mode... almost gave up!

After doing this, the git push command did work.

Maybe a step is missing from the instructions?


#3

I got the same error, and I think it was due to me trying to add the README file that github recommends. I solved it by typing git push -f origin master instead to do a forced update regardless of changes.


#4

Ah, good catch. I did add the README file. This would be the remote work that is not found locally.

If this is the case, things could be improved in the course rather easily by adding a small additional instruction to the exercise. :smiley:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.