我在/opt/gitlab-6.9.2-0/apps/gitlab/上在CentOs上建立了一个新的Gitlab,并在连续交付组下创建了一个新的存储库。完整的路径是/opt/gitlab-6.9.2-0/apps/gitlab/gitlab-satellites/continuous-delivery/cd-test。在此路径下只有一个文件,即README.txt。
我试图实现的是,当有人将更改推送到服务器上时,创建一个新文件。下面是我在服务器上所做的工作:
post-update回显"text“>> file_name`下创建.git/hooks/' each file creates a new file using和>>文件当我将更改从本地推送到服务器时,没有创建任何文件。所以,我想知道我要做些什么来解决这个问题。
更新1
我将post-receive和post-update添加到repositories路径中,作为VonC建议
[root@git-cd hooks]# pwd
/opt/gitlab-6.9.2-0/apps/gitlab/repositories/continuous-delivery/cd-test.git/hooks
[root@git-cd hooks]# ll
total 48
-rwxrwxr-x. 1 git git 452 Jun 10 06:01 applypatch-msg.sample
-rwxrwxr-x. 1 git git 896 Jun 10 06:01 commit-msg.sample
-rwxrwxr-x. 1 git git 44 Jun 11 00:37 post-receive
-rwxrwxr-x. 1 git git 41 Jun 11 00:38 post-update
-rwxrwxr-x. 1 git git 189 Jun 10 06:01 post-update.sample
-rwxrwxr-x. 1 git git 398 Jun 10 06:01 pre-applypatch.sample
-rwxrwxr-x. 1 git git 1642 Jun 10 06:01 pre-commit.sample
-rwxrwxr-x. 1 git git 1281 Jun 10 06:01 prepare-commit-msg.sample
-rwxrwxr-x. 1 git git 1352 Jun 10 06:01 pre-push.sample
-rwxrwxr-x. 1 git git 4972 Jun 10 06:01 pre-rebase.sample
lrwxrwxrwx. 1 git git 57 Jun 10 06:01 update -> /opt/gitlab-6.9.2-0/apps/gitlab/gitlab-shell/hooks/update
-rwxrwxr-x. 1 git git 3611 Jun 10 06:01 update.sample这两个文件都包含一个脚本,该脚本将新行添加到现有文件"post-receive-2" >> /var/log/hooks_test.log中。然后将更改从本地机器推送到服务器。但它仍然没有附加文本。
更新2
后发的剧本是错的,没有回音。在我添加回显(echo "post-receive-2" >> /var/log/hooks_test.log )之后,它就像预期的那样工作了!
发布于 2014-06-11 05:10:09
这将是因为这些卫星回复不是你想要的那个,所以它们的钩子不会在你思考的时候触发(也就是说,当有人推到GitLab服务器时不会触发)。
PR 6185介绍了结构概述文档
/home/git/gitlab-satellites-从web中签出合并请求和文件编辑的存储库。这可以作为临时文件目录来处理。 卫星存储库由web界面用于编辑存储库,wiki也是一个git存储库。
您应该将钩子添加到裸露的repos ~git/repositories中。
或者(更新Q4 2014,来自2014年11月GitLab 7.5+),您可以使用定制钩 (而不是网钩)作为杜卡的下文所述。
必须在GitLab服务器的文件系统上配置自定义git挂钩。 只有GitLab服务器管理员才能完成这些任务。如果您没有文件系统访问权限,请将webhooks作为一种选择。
/home/git/repositories/<group>/<project>.git。
对于Omnibus安装,路径通常是/var/opt/gitlab/git-data/repositories/<group>/<project>.git。custom_hooks的新目录。custom_hooks目录中,创建一个名称与钩子类型匹配的文件。
对于pre-receive钩子,文件名应该是没有扩展名的pre-receive。git。发布于 2014-12-29 15:24:55
从GitLab版本2.2.0 (它需要GitLab 7.5+)开始,GitLab管理员可以向任何GitLab项目添加自定义的git挂钩。因此,您必须升级,并按照这里的说明:hooks.html
发布于 2016-04-26 09:53:48
有关它的官方方法,请参阅自定义Git GitLab文档。
摘要:从GitLab版本2.2.0 (它需要GitLab 7.5+)开始,GitLab管理员可以向任何GitLab项目添加自定义的git挂钩。
/home/git/repositories/<group>/<project>.git,因为Omnibus安装路径通常是/var/opt/gitlab/git-data/repositories/<group>/<project>.gitcustom_hooks的新目录。custom_hooks目录中,创建一个名称与钩子类型匹配的文件。对于预接收钩子,文件名应该是pre-receive,没有扩展名。#!/usr/bin/env ruby。但是,请参阅上面的官方文档链接。上面是今天的快照..。
https://stackoverflow.com/questions/24154384
复制相似问题