Gitlab自定义钩子未运行 [英] Gitlab custom hook not running

查看:485
本文介绍了Gitlab自定义钩子未运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们将Gitlab与测试项目的dev / staging副本安装在同一服务器上。我们中的两个人拥有将Gitlab作为远程设备的本地工作副本,并且能够成功地将其推入/拉到Gitlab。我们还在项目的暂存副本中将Gitlab设置为远程对象,并且也从Gitlab中手动提取了它。

We have Gitlab installed on the same server as a dev/staging copy of our test project. Two of us have local working copies with Gitlab as a remote, and are able to push/pull to Gitlab successfully. We also have Gitlab set as a remote in the staging copy of the project, and pulling from Gitlab works there manually as well.

但是,为Gitlab创建自定义钩子时(如此处所述),该挂钩完全无法运行且没有错误。钩子的内容是:

However, when creating a custom hook for Gitlab (as described here), the hook simply fails to run with no errors. The content of the hook is:

#!/bin/bash

echo "Inside post_receive hook"
cd /path/to/staging/copy
git pull gitlab master

...其中 / path / to / staging / copy 是项目的暂存位置。这是所有权和钩子的权限:

...where /path/to/staging/copy is the staging location of the project. Here's the ownership & permissions of the hook:

-rwxr-xr-x。 1 git git 114 Mar 30 10:28 post_receive

从我的工作副本推送到Gitlab时,此钩子应该运行,但是不会运行t-暂存副本未更新,没有显示echo消息,并且push结果消息也未显示任何错误。

When pushing from my working copy to Gitlab, this hook should run, but it doesn't -- the staging copy is not updated, the echo message isn't shown, and the push results message doesn't show any errors.

我已经尝试了一些SO提示中有关设置/取消设置环境变量的提示,它们无济于事。我没主意了。有谁知道为什么自定义钩子没有运行?

I have tried a few tips from SO answers regarding setting/unsetting environment variables, and they didn't help. I'm out of ideas. Does anyone know why the custom hook isn't running?

推荐答案

当然,这是我的错。我用下划线而不是破折号给钩子命名错误。钩子现在会正确触发。

Of course, this was my fault. I mis-named the hook with an underscore instead of a dash. Hook now fires appropriately.

这篇关于Gitlab自定义钩子未运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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