Git pre-receive hook

How to configure the global pre-receive hook on server side? I want to block a specific type of file pushing. I think this hook code will work fine (https://github.com/github/platform-samples/blob/master/pre-receive-hooks/block_file_extensions.sh) But Don`t know how it will be configured in the server machine. I need a hand to achieve this.

Any suggestion?

Instruction on how to setup a pre-merge hook is explained in the following page.
https://docs.gitlab.com/ee/administration/custom_hooks.html

@hozawa Yes, I got the way to configure the global hook by this link (https://docs.gitlab.com/ce/administration/custom_hooks.html#chained-hooks-support).

I created the new file pre-receive.d in the /opt/gitlab/embedded/service/gitlab-shell/hooks and added the below two line to check if the hook working or not,

 #!/usr/bin/env bash
 echo "test bash hook"

But I didn`t get the above text in the git push screen. How can I confirm is this hook working or not?

Have you make the hook file executable? like chmod +x your-hook-file.sh

Hi folks.
I am also facing same issue with pre-recive hook which i make as executable file and also followed.
``mkdir -p /gitlab-shell/hooks/pre-receive.d
chown git:git /gitlab-shell/hooks/pre-receive.d

link or copy your script of course it needs to be executable by the Gitlab user

symlink to one common script

ln -s /usr/bin/my-hook /gitlab-shell/hooks/pre-receive.d/my-hook

while  am testing with users by pushing the confidential information they are able to do it.

Please help me over come this problem.