+8 votes
1 view
in DevOps and Agile by (30k 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

+10 votes
by (51.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.

by (30k points)
thanks, it helps me a lot.
Welcome to Intellipaat Community. Get your technical queries answered by top developers !