将镜像从海外服务器设置为本地服务器

时间:2014-01-05 00:24:01

标签: git repository mirror

我们的项目涉及中国的5名开发人员和美国的3名开发人员。中国的服务器机器被认为是主机。我想设置一个从中国服务器到美国服务器的repo镜像,这样我们的本地开发人员可以repo sync更快。现在来自中国服务器的repo init / sync用了5个小时。

例如,假设中国服务器名为server1.china.com,美国服务器名为server2.usa.com

使用以下命令从中国服务器提取项目:

repo init -u ssh://server1.china.com/projectA/standard.git -b release17
repo sync

我希望能够设置一个本地镜像,以便拉动项目:

repo init -u ssh://server2.usa.com/projectA/standard.git -b release 17
repo sync

我希望还需要一个cron作业来定期运行,以便在初始设置后将最新的更改从server1拉到server2。

我见过使用git clone --mirror的讨论,但不太确定它会给出我需要的内容。

由于

1 个答案:

答案 0 :(得分:1)

你想要的是repo init --mirror,来自repo init -h

--mirror            create a replica of the remote repositories rather
                    than a client working directory

创建后,您可以使用repo sync保持最新。