【发布时间】:2014-08-01 00:09:26
【问题描述】:
我在/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。
我试图实现的是当有人将更改推送到服务器时创建一个新文件。以下是我在服务器上所做的:
- 在
.git/hooks/' each file creates a new file usingecho "text" >> file_name`下创建post-update和update文件 - chmod 为 775。
当我将更改从本地推送到服务器时,没有创建文件。所以,我想知道我必须做些什么来解决这个问题。
更新 1
我将post-receive 和post-update 添加到repositories 路径为VonC suggested
[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
post-receive 中的脚本错误,它没有回显。添加回声后(echo "post-receive-2" >> /var/log/hooks_test.log 然后它按预期工作!
【问题讨论】:
标签: git continuous-integration gitlab