I would like to set up a Git repository on my local network as a mirror of another repository, only reachable over a slow WAN. The idea is that the local (bare) repo would serve as a cache, so new commits would only have to be pulled across the WAN once.
Is there a way to configure that intermediate repo (via hooks, etc.) to automatically fetch from its configured remote if a client tries to fetch from the intermediate repo? I'm trying to find a way to ensure that the clients always see the most up-to-date commits if they fetch.
I realize I could approximate this using a script called periodically via cron, but that introduces the possibility of missing very recent commits. I'm hoping to set up something more automatic if possible.
From my initial searches, there doesn't seem to be a "built-in" way to do this with Git alone, but I did find gitpod, a set of scripts that do what I want. I have it installed on my intermediate server, configured appropriately to fetch from the authoritative remote servers. I then have my clients configured to pull from the proxy server using the git:// protocol. It all seems to be working well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With