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

Re: need help with syncing two bare repos

From
Sitaram Chamarty <sitaramc@gmail.com>
Date
Aug 3, 2012, 19:14 UTC
Message-ID
<CAMK1S_jmML56ef2EVZqEX6i+_y-NyaoazZdXQQ+N88GWL4X2Qg@mail.gmail.com>
In-Reply-To
<CAPZPVFax6wa9QYOMxghhWK6LJaYWS2+WCbWQLA+LE53TdNXJhQ@mail.gmail.com>
On Fri, Aug 3, 2012 at 11:59 PM, Eugene Sajine <euguess@gmail.com> wrote:
Show 31 quoted lines
> Hi,
>
> Could somebody please advise about how to address the following:
>
> I have a bare repo (bareA) on one server in network1 and i have a
> mirror of it on another server (bareB) in network2
> BareB is updated periodically - no problem here
> If bareA dies users are supposed to move seamlessly to bareB.
> When bareA goes back up users are moved back but before it starts
> serving repos (before git-daemon starts) it updates from bareB.
>
> Now the problem i have is if bareA doesn't actually die, but the
> connection between two networks drops.
> In this case users from network2 will stop seeing bareA, they will
> start working with bareB, while users in netwrok1 will continue
> to work with bareA.
>
> What would be the best way of syncing the bareB back to bareA when
> connection is restored?
>
> I think the best variant would be to do something like:
>
> $ git pull --rebase /refs/heads/*:/refs/heads/*
> $ git push origin /refs/heads/*:/refs/heads/*
>
> but pull will not work on bare repos as i understand and there might
> be conflicts that will lead to unknown (for me) state of bare repos
>
> May be I'm looking into wrong direction? May be simple two way rsync
> will do the job? But I'm a bit reluctant to rely on rsync because I'm
> afraid it may screw up the repository information.

The way I solve this is to insist that I *manually* specify which is the push destination and not make it automated. The other one is a read-only mirror until something is manually switched.

Might not be ideal for every situation; your call...
Previous: Eugene SajineNext: Junio C Hamano
Message 2 of 5 in “need help with syncing two bare repos”
  1. Eugene SajineAug 3, 2012
  2. Sitaram ChamartyAug 3, 2012
  3. Junio C HamanoAug 3, 2012
  4. Eugene SajineAug 3, 2012
  5. Junio C HamanoAug 3, 2012

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.