假设机器A上已经有了git仓库test.git,要在机器B上镜像这个git仓库,则需要在机器B上执行:
git clone --mirror ssh://git@git.xxxx.a/group/test.git
也即在机器B上,以git clone --mirror的方式将git仓库从机器A上clone下来,这时机器B上就有了一份跟机器A一模一样的git仓库了。然后在机器B上配置一个cron,时不时地从机器A上同步一下就行了:
git --git-dir=/home/test.git remote update
最后使用git push将同步到B机器 上的代码提交到远程仓库
git push --mirror https://git.xxxxx.b/group/test.git
2156

被折叠的 条评论
为什么被折叠?



