是否可以在Gitolite中实现基于回购的挂钩? [英] Is it possible to implement repo based hooks in Gitolite?

查看:72
本文介绍了是否可以在Gitolite中实现基于回购的挂钩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在gitolite中实现基于回购的钩子.

I want to implements repo based hooks in gitolite.

有可能吗?

我正在使用3号乙醇钠(g3).

I am using gitolite 3 (g3).

推荐答案

自Gitolite 3.6+起,可以通过"

Since Gitolite 3.6+, it is possible with "repo-specific hooks":

  • 将此行添加到%RC 块中的 rc 文件中(如果尚不存在),或取消注释(如果已存在并注释掉):
  • 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 => "$rc{GL_ADMIN_BASE}/local",

  • 取消注释 rc 文件中的" repo-specific-hooks "行,或者将其添加到 ENABLE 列表中不存在.

  • uncomment the 'repo-specific-hooks' line in the rc file or add it to the ENABLE list if it doesn't exist.

如果您的 rc 文件没有 ENABLE 列表,则需要将其添加到 POST_COMPILE POST_CREATE 列表.单击此处,以获取有关所有这些内容的更多信息.

If your rc file does not have an ENABLE list, you need to add this to the POST_COMPILE and the POST_CREATE lists. Click here for more on all this.

将您的钩子插入到 gitolite-admin 克隆中,如下所示:

put your hooks into your gitolite-admin clone, as follows:

工作站上的

# on your workstation
cd /path/to/your/gitolite-admin-clone
mkdir -p local/hooks/repo-specific

  • 现在将钩子添加到该目录,但不要使用git标准"名称(预接收后接收更新后),则使用描述性名称(例如" deploy "," RSS-post "等).

  • Now add your hooks to that directory, but instead of using the git "standard" names (pre-receive, post-receive, post-update), you use descriptive names (e.g. "deploy", "RSS-post", etc).

将它们添加到您希望它们在conf文件中处于活动状态的仓库中.例如:

add them to the repos you want them to be active in, in your conf file. For example:

repo foo
    option hook.post-update     =   jenkins
repo bar @baz
    option hook.post-update     =   deploy RSS-post

  • 添加,提交和推送管理仓库.

这篇关于是否可以在Gitolite中实现基于回购的挂钩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆