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

Re: How to efficiently backup a bare repository?

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 25, 2018, 01:16 UTC
Message-ID
<xmqqy39i0xee.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<8736rq14fe.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> There's no easy out of the box way to do exactly what you've
> described. A few things come to mind:
> ...
Wouldn't it suffice to have a cron job that runs something like
	D=$(date +"%Y-%m-%d")
	git fetch $serving "refs/*:refs/backup-$D/*"

on the back-up box to fetch from the repository on the box the end-users push into once a day? In the back-up repository, the refs/backup-2018-11-25/heads/master reference would be today's tip of the master branch of the serving repository. You can set the expiry timeout to "now" (i.e. "gc" will immediately drop unreachable objects, and that is fine because you expicitly have refs to pin these objects anyway), get the dedup from "git fetch" for free, repack the backup repository as a whole, and dropping the whole refs/backup-2018-10-25/* hierarcy on 2018-11-25 is all you need to expire the refs.

You may want to play with the ref-advertisement limiting options in the recent Git, if it is too much to grow the amount of "have"s by 30x for the common ancestry negotiation. But that is a small implementation detail.

Previous: Ævar Arnfjörð Bjarmason
Message 3 of 3 in “How to efficiently backup a bare repository?”
  1. Guilhem BonnefilleNov 23, 2018
  2. Ævar Arnfjörð BjarmasonNov 24, 2018
  3. Junio C HamanoNov 25, 2018

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.