Possible to ‘chain’ git repos

git

Say I have a local dev machine, and I set the git origin to be another machine '2', is it possible to have machine2's git origin set to another machine? This would let me push my code from dev to machine2, and have machine3 as a remote backup for the repo on machine2.

Thanks

Best Answer

Yes of course. The remote repositories are just pointers and each repository is in effect independent of the other. You don't necesarily have to have machine3 as the origin, it can just be another remote link.

Also don't forget you can have as many remote repository references as you want. git repositories aren't just set up in a straight parent/child relationship line.

You can use some of the git hooks in .git/hooks to automate this process.

Related Topic