I’ve just installed a fresh version of gitlab on my own server @ {“version”:“15.3.3-ee”,“revision”:“1615d086ad8”}
System information
System: Debian 11
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.7.5p203
Gem Version: 3.1.6
Bundler Version:2.3.15
Rake Version: 13.0.6
Redis Version: 6.2.7
Sidekiq Version:6.4.0
I tried to follow this guide to set up a post-receive hook : Server hooks | GitLab
I confirmed the location of the git repo via console and made the custom_hooks folder
root@gitlab:/var/opt/gitlab/git-data/repositories/@hashed/4a/44# ls -l
total 12
drwx--S--- 5 git git 4096 Sep 7 14:40 4a44dc15364204a80fe80e9039455cc1608281820fe2b24f1e5233ade6af1dd5.git
drwx--S--- 4 git git 4096 Sep 7 14:09 4a44dc15364204a80fe80e9039455cc1608281820fe2b24f1e5233ade6af1dd5.wiki.git
drwxr-sr-x 2 git git 4096 Sep 7 14:38 custom_hooks
Created the file with proper owner. I tried multiple permissions settings.
root@gitlab:/var/opt/gitlab/git-data/repositories/@hashed/4a/44# cd custom_hooks/
root@gitlab:/var/opt/gitlab/git-data/repositories/@hashed/4a/44/custom_hooks# ls -l
total 4
-rwxrwxrwx 1 git git 43 Sep 7 14:34 post-receive
The file is a simple test script
#!/bin/bash
echo "test custom" > /tmp/hook
which runs properly when manually run as git user
git@gitlab:~/git-data/repositories/@hashed/4a/44/custom_hooks$ ./post-receive
git@gitlab:~/git-data/repositories/@hashed/4a/44/custom_hooks$ cd /tmp/
git@gitlab:/tmp$ ls -l
total 44
-rw-r--r-- 1 git git 12 Sep 7 14:46 hook
However I can’t get it to run on a push from local to remote (gitlab) repo. The repo files do update properly.
I would appreciate any help you could provide.