How to synchronize 2 bare repositories in Gitolite?

旧时模样 提交于 2019-12-08 03:47:27

问题


I have a following requirement,two remote bare repositories repository A and repository B and my aim is to sync or push repoA contents to repoB @regular intervals.

I use Gitolite v3 btw, should I go for Gitolite mirroring or post-receive hooks? if its a post-receive, how to achieve it?


回答1:


Certainly adding a post-receive hook (see "(v3.6+) variation: repo-specific hooks") is the easiest way.

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, but that it a bit overkill).
Plus it adds:

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.

That means:

If you have multiple gitolite servers to maintain, then mirroring is interesting, mainly because the push --mirror is done asynchronously from the initial git push to repoA.
In that aspect, gitolite mirroring is quicker, because you push to A, and in the background, gitolite will push --mirror to other gitolite servers.

But here, for just one other repo (on the same gitolite server, or on another gitolite server), a simple post-receive hook is enough.



来源:https://stackoverflow.com/questions/33255600/how-to-synchronize-2-bare-repositories-in-gitolite

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!