git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Tennant <sdt@sebyte.me>
To: git@vger.kernel.org
Subject: How to mirror and augment a git repository
Date: Sat, 04 Mar 2023 12:19:16 +0000	[thread overview]
Message-ID: <87ilfgemkb.fsf@sebyte.me> (raw)

Hello list,

I wish to mirror _and augment_ an upstream git repository.

              .--------.
              |Upstream|
              '--------'
                   |
          .----------------.
          |Augmented mirror|
          '----------------'
           /       |       \
   .--------. .--------. .--------.
   |Client#1| |Client#2| |Client#3|
   '--------' '--------' '--------'

Clients of the augmented mirror must have access to everything
available from upstream but must also be able to collaborate on
additional development branches not available from upstream.

Initial approach:

 Augmented mirror:

   $ git clone --mirror <upstream> upstream
   $ cd upstream
   $ git remote update  # regular cron job

 Clients (bare repo & worktrees preferred):

   $ git clone --bare <mirror> mirror
   $ cd mirror
   $ git config remote.origin.fetch\
         "+refs/heads/*:refs/remotes/origin/*"
   $ git remote update


This arrangement worked fine until I decded to run:

   $ git remote prune origin

on the augmented mirror and lost all the additional development
branches the clients had added and shared amongst themselves.

I've tried running the augmented mirror as a plain bare repo, i.e.

   $ git config --unset remote.origin.fetch
   $ git config --unset remote.origin.mirror

but then the cron job (git remote update) is no longer sufficient in
making all upstream activity available downstream.

So, how best to run an augmented mirror such as this?

If my initial approach was correct, is there a way to protect the
additional branches so that ‘git remote prune origin’ may be run
safely on the augmented mirror from time to time?

Any help/tips/pointers/suggestions much appreciated.

Sebastian

             reply	other threads:[~2023-03-04 12:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-04 12:19 Sebastian Tennant [this message]
2023-03-05  9:02 ` How to mirror and augment a git repository Bagas Sanjaya
2023-03-05  9:50   ` Sebastian Tennant
2023-03-06  8:08 ` Jeff King
2023-03-08 16:54   ` Sebastian Tennant
2023-03-09  3:12     ` Jeff King
2023-03-11 10:47       ` Sebastian Tennant
2023-03-11 14:55         ` Jeff King
2023-03-12 18:11           ` Sebastian Tennant
2023-03-13 16:30             ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilfgemkb.fsf@sebyte.me \
    --to=sdt@sebyte.me \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).