git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git push bug?

From
Shawn O. Pearce <spearce@spearce.org>
Date
Oct 19, 2007, 00:49 UTC
Message-ID
<20071019004926.GR14735@spearce.org>
In-Reply-To
<1192723847.9433.25.camel@gentoo-jocke.transmode.se>
Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:
Show 17 quoted lines
> BTW this does not work either:
> 
> git reset --hard HEAD^
> git push -f  ssh://devsrv/var/git/os2kernel.git +master:master
> updating 'refs/heads/master'
>   from 9c344d18d01221c8f25080cb58910e6b09efbf55
>   to   5761a9e5924b34615c748fba2dcb977ed04c1243
> Generating pack...
> Done counting 0 objects.
> Writing 0 objects...
> Total 0 (delta 0), reused 0 (delta 0)
> error: denying non-fast forward refs/heads/master (you should pull first)
> ng refs/heads/master non-fast forward
> error: failed to push to 'ssh://devsrv/var/git/os2kernel.git'
> 
> I thought the + in +master:master and the -f option should let me
> do that.
Yes, but its only on the client side.

See when we do a push the local client side determines if the push is going to be a fast-forward or not. If it isn't then the git-push client aborts before it even uploads data to the remote side. The --force or + can be used to make the client side skip this check and just plow forward anyway.

But the remote side can also veto a non-fast-forward update. By default it refuses to allow such updates as they can orphan commits (and thus potentially lose important work). See the config option receive.denyNonFastForwards; you may want to set this to true in the remote side's config file.

-- 
Shawn.
Previous: Joakim TjernlundNext: Steffen Prohaska
Message 5 of 21 in “git push bug?”
  1. Joakim TjernlundOct 18, 2007
  2. Steffen ProhaskaOct 18, 2007
  3. Joakim TjernlundOct 18, 2007
  4. Joakim TjernlundOct 18, 2007
  5. Shawn O. PearceOct 19, 2007
  6. Steffen ProhaskaOct 18, 2007
  7. Johannes SchindelinOct 18, 2007
  8. Joakim TjernlundOct 18, 2007
  9. Johannes SchindelinOct 18, 2007
  10. Joakim TjernlundOct 19, 2007
  11. Johannes SchindelinOct 19, 2007
  12. Joakim TjernlundOct 19, 2007
  13. Johannes SchindelinOct 19, 2007
  14. Jan HudecOct 20, 2007
  15. Steffen ProhaskaOct 18, 2007
  16. Johannes SchindelinOct 18, 2007
  17. Steffen ProhaskaOct 20, 2007
  18. Steffen ProhaskaOct 20, 2007
  19. Joakim TjernlundOct 20, 2007
  20. Shawn O. PearceOct 19, 2007
  21. Joakim TjernlundOct 20, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.