严格的 Gitolite 配置

Strict Gitolite configuration

我正在设置严格限制的 Gitolite 服务器。 Gitolite 文档很好,但我认为如果我正在做的是好的方法,我仍然需要一些建议。

用户应该只能访问 master 分支。他们不能不能创建任何分支或标签。我也想防止强制推动。用户唯一能做的就是简单提交。

我不确定这样做是否可行

repo foo

RW+                     =  @sync
RW   master              =  user

需要触发触发器或其他东西来通知服务更改并保持数据库同步。

提交后获取差异的更好方法是什么。我需要同步数据库中的所有提交。我能想到的一种方法是使用 @sync 和 运行 git diff 之类的用户将 repo 克隆到 tmp 目录。有没有更好的方法来完成这个?

您可以添加自己的update hooks, or, in your case, a post-receive hook

add this line in the rc file, within the %RC block, if it's not already present, or uncomment it if it's already present and commented out:

LOCAL_CODE => "$ENV{HOME}/local",

put your hooks into that directory, in a sub-sub-directory called "hooks/common":

这样的钩子 (post-receive) 可以在其中做一个 git diff:见 this example

git diff-tree --stat --summary --find-copies-harder $oldrev..$newrev

重点是:无需clone repo:hook会在每次推送后执行。