• Home
  • LinuxGit
  • Git – Force overwrite of a remote git with a local git

Git – Force overwrite of a remote git with a local git

I had a Google code project for my kernel which I made long ago, and wanted to overwrite it with my updated local git.

First I add the remote:

git remote add googlecode https://code.google.com/p/supernovakernel/[/code]

Then I force a push:

git push -f googlecode master[/code]

 

If I do a normal push, this was the error:

git push googlecode master
To https://code.google.com/p/supernovakernel/
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://code.google.com/p/supernovakernel/'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.[/code]