Motohiro Takayama

  • Archive
  • RSS

Sync Multiple Remote Git Repositories

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.

  • Clone the repoA in local (repoL): git clone --mirror remote.in.intranet:repoA repoL
  • cd repoL
  • Add a remote repository that is pushed only: git add remote --mirror=push repoB remote.in.local.network:repoB
  • git push repoB

That’s it. To sync them:

  • git fetch --bare
  • git push repoB

Will pull all refs, branches, and tags from repoA and push all of them to repoB.

Thanks to the stackoverflow discussion.


リモートにある複数の Git レポジトリを sync したいときにどうするか、という話。

    • #git
  • 9 months ago
  • 2
  • Comments
  • Permalink
  • Share
    Tweet

About

Avatar 今週はがんばってブログをかくよ

Pages

  • About

Me, Elsewhere

  • @mootoh on Twitter
  • Facebook Profile
  • mootoh on Vimeo
  • mootoh on Flickr
  • mootoh on Delicious
  • mootoh on Pinboard
  • tiltowaito on Last.fm
  • mootoh on Soundcloud
  • mootoh on Rdio
  • mootoh on Foursquare
  • Linkedin Profile
  • mootoh on github

loading tweets…

  • RSS
  • Random
  • Archive
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr