I have a remote bare git repository created following:
@server:~$ mkdir -p /home/myuser/domain.git && chmod 770 /home/myuser/domain.git && cd /home/myuser/domain.git && git init --bare
With a post-receive hook:
@server:~$ nano hooks/post-receive
The hook script is:
#!/bin/sh
git --work-tree=/var/www/domain --git-dir=/home/myuser/domain.git checkout -f
It has permission to execute:
@server:~$ chmod +x hooks/post-receive
However, it only changes the website when I push to the master branch.
Why? The remote HEAD is always master, even if I push to another branch.