How do you organise multiple git repositories, so that all of them are backed up together?

前端 未结 6 1387
梦毁少年i
梦毁少年i 2020-12-22 14:55

With SVN, I had a single big repository I kept on a server, and checked-out on a few machines. This was a pretty good backup system, and allowed me easily work on any of the

6条回答
  •  悲哀的现实
    2020-12-22 15:20

    I want to add to Damien's answer where he recommends:

    $ for remote in origin github memorystick; do git push $remote; done
    

    You can set up a special remote to push to all the individual real remotes with 1 command; I found it at http://marc.info/?l=git&m=116231242118202&w=2:

    So for "git push" (where it makes sense to push the same branches multiple times), you can actually do what I do:

    • .git/config contains:

      [remote "all"]
      url = master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
      url = login.osdl.org:linux-2.6.git
      
    • and now git push all master will push the "master" branch to both
      of those remote repositories.

    You can also save yourself typing the URLs twice by using the contruction:

    [url ""]
        insteadOf = 
    

提交回复
热议问题