如何在 Gitolite 中同步 2 个裸存储库?
How to synchronize 2 bare repositories in Gitolite?
我有以下要求,两个远程裸存储库存储库 A 和存储库 B,我的目标是将 repoA
内容同步或推送到 repoB
@定期。
我使用 Gitolite v3 顺便说一句,我应该使用 Gitolite 镜像还是 post-接收挂钩?如果是 post-receive,如何实现?
当然,添加一个 post-receive hook(参见“(v3.6+) variation: repo-specific hooks”)是最简单的方法。
cd /path/to/your/gitolite-admin-clone
mkdir -p local/hooks/repoA
git push --mirror ../repoB
Mirroring is mainly for synchronization between different gitolite servers (I suppose it could be setup to mirror on the same server as in t/mirror-test
,但有点矫枉过正)。
加上它添加:
From v3.5.3 on, gitolite uses an asynchronous push to the slaves, so that the main push returns immediately, without waiting for the slave pushes to complete.
Keep this in mind if you're writing scripts that do a push, and then read one of the slaves immediately -- you will need to add a few seconds of sleep in your script.
这意味着:
如果你有多个 gitolite服务器要维护,那么镜像就很有趣,主要是因为push --mirror
是从最初的git push
到repoA异步完成的.
在这方面,gitolite镜像更快,因为你推到A,在后台,gitolite会push --mirror
到其他gitolite服务器
但是在这里,对于另一个 repo(在同一个 gitolite 服务器上,或在另一个 gitolite 服务器上),一个简单的 post-receive hook 就足够了。
我有以下要求,两个远程裸存储库存储库 A 和存储库 B,我的目标是将 repoA
内容同步或推送到 repoB
@定期。
我使用 Gitolite v3 顺便说一句,我应该使用 Gitolite 镜像还是 post-接收挂钩?如果是 post-receive,如何实现?
当然,添加一个 post-receive hook(参见“(v3.6+) variation: repo-specific hooks”)是最简单的方法。
cd /path/to/your/gitolite-admin-clone
mkdir -p local/hooks/repoA
git push --mirror ../repoB
Mirroring is mainly for synchronization between different gitolite servers (I suppose it could be setup to mirror on the same server as in t/mirror-test
,但有点矫枉过正)。
加上它添加:
From v3.5.3 on, gitolite uses an asynchronous push to the slaves, so that the main push returns immediately, without waiting for the slave pushes to complete.
Keep this in mind if you're writing scripts that do a push, and then read one of the slaves immediately -- you will need to add a few seconds of sleep in your script.
这意味着:
如果你有多个 gitolite服务器要维护,那么镜像就很有趣,主要是因为push --mirror
是从最初的git push
到repoA异步完成的.
在这方面,gitolite镜像更快,因为你推到A,在后台,gitolite会push --mirror
到其他gitolite服务器
但是在这里,对于另一个 repo(在同一个 gitolite 服务器上,或在另一个 gitolite 服务器上),一个简单的 post-receive hook 就足够了。