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

How to mirror and augment a git repository

From
STSebastian Tennant <sdt@sebyte.me>
Date
Mar 4, 2023, 12:19 UTC
Message-ID
<87ilfgemkb.fsf@sebyte.me>
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
Next: Bagas Sanjaya
Message 1 of 10 in “How to mirror and augment a git repository”
  1. Sebastian TennantMar 4, 2023
  2. Bagas SanjayaMar 5, 2023
  3. Sebastian TennantMar 5, 2023
  4. Jeff KingMar 6, 2023
  5. Sebastian TennantMar 8, 2023
  6. Jeff KingMar 9, 2023
  7. Sebastian TennantMar 11, 2023
  8. Jeff KingMar 11, 2023
  9. Sebastian TennantMar 12, 2023
  10. Jeff KingMar 13, 2023

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.