I am trying to set up a custom post-receive hook using gitlab
I am following their documentation here
I have an executable post-receive file in the custom_hooks folder with the following code:
!/bin/bash
echo "post-receive firing | wall
git pull
If I run this file with:
./post-receive
It works fine. It does not appear to fire at all when a push is made to the gitlab repo.
This is the first time I have ever tried web hooks of any kind so I am a little lost.
a) I have the above script on my remote webserver, inside the .git/custom_hooks folder, is this correct?
b) Do I need to do anything in the repo?
c) In the documentation, it specifies I should set permissions on the file so it is owned by the 'git' user. I have no git user on the webserver... all other git related files are owned by my user or root.
So assuming I am doing something completely wrong here, can someone please put me out of my misery and suggest a sane way to auto push to a web server whenever I push to gitlab from a local machine. I feel like I have spent some time looking for a way to do this and solutions seem to be complete overkill (cronjob running every few seconds...) or like the above, do not seem to work. Or at least I seem incapable of making them work.
Surely this is a straightforward task...