Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sharbel93/ebcf0b18782573f4d95f80caa3c84acb to your computer and use it in GitHub Desktop.
Save sharbel93/ebcf0b18782573f4d95f80caa3c84acb to your computer and use it in GitHub Desktop.
How to solve this problem of "! [rejected] master -> master (fetch first)"
First Do this ...
git fetch origin master
git merge master
Then, do this ...
git fetch origin master:tmp
git rebase tmp
git push origin HEAD:master
git branch -D tmp
Now everything works well.
@22vedant
Copy link

Thank you!

@SabaloZua
Copy link

Thank you bro💯💯💯!

@pichuka123
Copy link

this is working only for the first time sir.. again if i made any changes and push, again this error appearing.
any permanent fix for this please ?

@ThilanHemachandra
Copy link

thank you so much it helped me a lot.

@YUVI-8000
Copy link

thank you so much it worked well !!

@DAM92578
Copy link

Thank you very much!

@rmpranto
Copy link

Thanks

@mungaig
Copy link

mungaig commented Nov 18, 2024

Thanks so much

@Ashwani133
Copy link

Can somebody please explain, why do we get this error? And how these above lines of code solves the issue!
ps-issue is resolved. Please someone explain.

@PrincyEdwin
Copy link

Thanks a lot!

@Joao123433
Copy link

Thank you sir.

@SonamPal001
Copy link

Thankyou so much!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment