You have a git repository (repoA) as origin, which you only pull from. Sometimes the repoA is in the intranet and not accessible from the internet. You want to create a mirrored repository (repoB) in your local network for the convenience.
git clone --mirror remote.in.intranet:repoA repoLcd repoLgit add remote --mirror=push repoB remote.in.local.network:repoBgit push repoBThat’s it. To sync them:
git fetch --baregit push repoBWill pull all refs, branches, and tags from repoA and push all of them to repoB.
Thanks to the stackoverflow discussion.
リモートにある複数の Git レポジトリを sync したいときにどうするか、という話。