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

Re: Overriding ~/.gitconfig using GIT_CONFIG

From
Jeff King <peff@peff.net>
Date
Aug 30, 2011, 18:49 UTC
Message-ID
<20110830184951.GA19204@sigill.intra.peff.net>
In-Reply-To
<1314729545.5939.391.camel@rex>
On Tue, Aug 30, 2011 at 07:39:05PM +0100, Richard Purdie wrote:
Show 28 quoted lines
> On Tue, 2011-08-30 at 11:56 -0400, Jeff King wrote:
> > On Tue, Aug 30, 2011 at 01:13:01PM +0100, Richard Purdie wrote:
> > 
> > > We've gone through several iterations of this but as things stand now,
> > > to initially clone things we're doing:
> > > 
> > > git clone --bare --mirror <url> <dir>
> > > 
> > > but if we already have some existing clone we'd update with:
> > > 
> > > git remote prune origin
> > > git remote rm origin
> > > git remote add --mirror origin <url>
> > > git fetch --all -t
> > >
> > > [...]
> > >
> > > So if a user has an origin remote in their .gitconfig, can we ignore it?
> > 
> > Wouldn't:
> > 
> >   git fetch --prune <url> refs/heads/*:refs/remotes/origin/*
> > 
> > do what you want, and not look at config at all?
> 
> Since this is a bare/mirror clone, wouldn't that need to be:
> 
>  git fetch --prune <url> refs/heads/*:refs/heads/*
Sorry, yes, I forgot about the mirroring bit.
> That also wouldn't fetch tags?

It would only do autofollowing. You could use "-t", but if you really want a straight mirror, you could do:

  git fetch --prune refs/*:refs/*
to get everything.
-Peff
Previous: Richard PurdieNext: Richard Purdie
Message 11 of 12 in “Overriding ~/.gitconfig using GIT_CONFIG”
  1. Richard PurdieAug 12, 2011
  2. Junio C HamanoAug 12, 2011
  3. Junio C HamanoAug 12, 2011
  4. Richard PurdieAug 12, 2011
  5. David AguilarAug 28, 2011
  6. Richard PurdieAug 29, 2011
  7. David AguilarAug 30, 2011
  8. Richard PurdieAug 30, 2011
  9. Jeff KingAug 30, 2011
  10. Richard PurdieAug 30, 2011
  11. Jeff KingAug 30, 2011
  12. Richard PurdieSep 5, 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.