2

I want to push a local repo to multiple remote GIT repositories to achieve redundancy in my backup scheme. So, let's say I plan to use Github and BitBucket to host my repositories.

I have two questions.

  1. Is this approach advisable?
  2. If so, how should I best approach writing a shell script to automate my backup procedures? For example, would I need to change my repo identity in the shell script for every backup operation or does a set of commands exist that will make this process easier?
9
  • Do you even need a shell script? Just use git push Commented May 4, 2016 at 3:14
  • 1
    @immibis: My question regards that I will have multiple repos. So are you saying the best approach would be to manually change the repo destination prior to each git push command? What if I have more than two repos for redundancy? I was hoping there might be a way to submit a list of target repos that can be "shotgun blasted" with a single git push command for the purposes of redundancy.
    – Mowzer
    Commented May 4, 2016 at 3:20
  • 3
    git push origin master; git push backup master would work, if your two remotes are called origin and backup for example. Commented May 4, 2016 at 3:21
  • 2
    You can probably use git hooks to push to other remotes after having pushed to e.g. origin
    – stijn
    Commented May 4, 2016 at 7:12
  • 1
    I personally would use a post-receive hook, and inside that have n push commands to n redundant repos Commented May 4, 2016 at 10:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.