Explore Courses Blog Tutorials Interview Questions
+6 votes
in DevOps and Agile by (29.3k points)
edited by

For some reason, I can't push now, whereas I could do it yesterday. Maybe I messed up with configs or something.

When I use the git push origin master

error: failed to push some refs to github url


1 Answer

+8 votes
by (50.2k points)
selected by
Best answer

If the github repo is pushed with new changes and your local repo doesn't have that changes this error occurs for this you could use:

git pull -rebase

git push

The full syntax is:

git pull --rebase origin master

git push origin master

For pushing, I would recommend you to use -u option:

git push -u origin master

That would establish a tracking relationship between your local master branch and its upstream branch.

For more educational resources on Github, you can visit Github Tutorial.

failed to push some refs to github
by (29.3k points)
thanks, it helps me a lot.

Browse Categories