Gitlab 同步文件夹 "hooks" 在组的所有存储库中
Gitlab syncing folder "hooks" in all repositories of group
我在我的服务器上本地设置了 Gitlab。我注意到,当我向某个存储库中的 "post-receive" 文件添加一些代码时,所有更改都适用于该组中的所有其他存储库。
如何停止?
Normally, Git hooks are placed in the repository or project's hooks directory. GitLab creates a symlink from each project's hooks directory to the gitlab-shell hooks directory for ease of maintenance between gitlab-shell upgrades.
这解释了为什么您的挂钩似乎传播到组的 所有 回购。
Follow the steps below to set up a custom hook:
- Pick a project that needs a custom Git hook.
- On the GitLab server, navigate to the project's repository directory. For an installation from source the path is usually
/home/git/repositories/<group>/<project>.git
.
For Omnibus installs the path is usually /var/opt/gitlab/git-data/repositories/<group>/<project>.git
.
- Create a new directory in this location called
custom_hooks
.
- Inside the new custom_hooks directory, create a file with a name matching the hook type.
For a pre-receive
hook the file name should be pre-receive
with no extension.
- Make the hook file executable and make sure it's owned by git.
- Write the code to make the Git hook function as expected
我在我的服务器上本地设置了 Gitlab。我注意到,当我向某个存储库中的 "post-receive" 文件添加一些代码时,所有更改都适用于该组中的所有其他存储库。
如何停止?
Normally, Git hooks are placed in the repository or project's hooks directory. GitLab creates a symlink from each project's hooks directory to the gitlab-shell hooks directory for ease of maintenance between gitlab-shell upgrades.
这解释了为什么您的挂钩似乎传播到组的 所有 回购。
Follow the steps below to set up a custom hook:
- Pick a project that needs a custom Git hook.
- On the GitLab server, navigate to the project's repository directory. For an installation from source the path is usually
/home/git/repositories/<group>/<project>.git
.
For Omnibus installs the path is usually/var/opt/gitlab/git-data/repositories/<group>/<project>.git
.- Create a new directory in this location called
custom_hooks
.- Inside the new custom_hooks directory, create a file with a name matching the hook type.
For apre-receive
hook the file name should bepre-receive
with no extension.- Make the hook file executable and make sure it's owned by git.
- Write the code to make the Git hook function as expected