Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save mingderwang/94205de855af7c60cafa88564ea6abd7 to your computer and use it in GitHub Desktop.
Save mingderwang/94205de855af7c60cafa88564ea6abd7 to your computer and use it in GitHub Desktop.
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.
$ git pull origin master //run this first, then
$ git push origin master
@dipakshendge
Copy link

I even had the same issue and i couldn't fix it with git pull but i tried this and it worked:
git push -f origin master
So try all previous steps but for git push use argument -f

This worked great for me, thank you @Xenia-Io

thanks it's working...

@vinaykasam13
Copy link

Thank you so much, worked for me as well

@RadriaansNES
Copy link

Nothing was working from me. Copied previously local git files from folder into new folder and easily overwrote it.

@Shubham651-creator
Copy link

It's work very fine, thanks!

@Rakshitharashgithub
Copy link

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.

please check the above error I'm getting while push please check and let me know the solution

@Shubham651-creator
Copy link

I am just run only two commands.

  1. git pull origin
  2. git push origin

@GurwinderSethi
Copy link

Thank you so much for such a magnificent work

@ejazulhaq91
Copy link

great! git push -f main worked for me

@ashutoshlivnest
Copy link

git pull origin main
git add .
git commit -m "Merge remote changes"
git push origin main

@RonaldBeckstead
Copy link

I am having a problem, can I ask it here or start a new thread?

@thibapso
Copy link

thibapso commented Feb 6, 2024

Bro didn't work for me this solutions.Dont give trash info.You failed bro.So my friend Onur solved this problem.Don't do this againn maan.İf you don't know, don't sniff again.

try git push -f origin master

This worked for me. Thank you so much!

@LevarGoldun
Copy link

Thanks, it all worked. Most likely my error was due to the fact that I manually uploaded the file to github, but locally it wasn't showing up.

@spxctr00m
Copy link

I used git push -f origin main and it worked for me.

@M1k3ll
Copy link

M1k3ll commented May 1, 2024

use "--force"
"git push -u origin main --force

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