Eric Guo's blog.cloud-mes.com

in HTML5, JavaScript, Ruby & Rails, Python, and Cloud MES!

Setup Mirror Between 2 or More Git Server Using Hooks Script

Permalink

First make sure the two server can using ssh to login each other, then add remote mirror to bare git repository.

git remote add --mirror=push cvpgitip01 git@10.11.37.110:repositories/Feng-Wu/demo.git

Add hooks post-commit in bare git repository.

#!/bin/sh
exec git push cvpgitip01 -f --mirror

Comments