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

Re: [PATCH 2/3] remote: separate the concept of push and fetch mirrors

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 30, 2011, 20:45 UTC
Message-ID
<7vhbakmj5k.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110330195318.GB30624@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 10 quoted lines
> git-remote currently has one option, "--mirror", which sets
> up mirror configuration which can be used for either
> fetching or pushing. It looks like this:
>
>   [remote "mirror"]
>     url = wherever
>     fetch = +refs/*:refs/*
>     mirror = true
>
> However, a remote like this can be dangerous and confusing.

When --mirror was introduced at 3894439 (Teach "git remote" a mirror mode, 2007-09-02), it was only about fetching into a bare repository from another repository and there wasn't any confusion.

I knew about this potential confusion when we applied 84bb2df (Add a remote.*.mirror configuration option, 2008-04-17), but chose to be lazy and ignored the issue, thinking that users are intelligent enough not to mix these obviously incompatible modes of operation. If a repository is a mirror to fetch from somebody else, you wouldn't develop in it in the first place, and you would definitely not push it back to where you are mirroring from. If a repository is mirrored into somewhere else to publish your work in there, you wouldn't be fetching back from there to obliterate your work.

Being explicit like your series does is much safer than relying on "common sense".

I briefly wondered if this affects one use case where you want to configure a bare repository at your firewall boundary as a relay that mirrors an external public repository of somebody else by fetching and then publishes that to a repository internal to your network by pushing, but in that case you would have two remotes (the external --mirror=fetch one, and the internal --mirror=push one) that are separate, so it is not an issue.

Thanks for cleaning up the two-year old mess.
Previous: Jeff KingNext: Jeff King
Message 6 of 13 in “checkout new branch tracks wrong remote (bug?)”
  1. chrisMar 30, 2011
  2. Jeff KingMar 30, 2011
  3. 0/3 better "remote add --mirror" semanticsJeff King, Mar 30, 2011
  4. 1/3 remote: disallow some nonsensical option combinationsJeff King, Mar 30, 2011
  5. 2/3 remote: separate the concept of push and fetch mirrorsJeff King, Mar 30, 2011
  6. Junio C HamanoMar 30, 2011
  7. Jeff KingMar 30, 2011
  8. Junio C HamanoMar 30, 2011
  9. chrisMar 31, 2011
  10. chrisMar 31, 2011
  11. Junio C HamanoMar 31, 2011
  12. chrisMar 31, 2011
  13. 3/3 remote: deprecate --mirrorJeff King, Mar 30, 2011

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.