Here the context:
- Local development on my computer
- Source code pushed on Github
- Remote server deployment with a bare repo
- post-receive hook set on the bare repo to deploy on the Apache directory
- New content deployment via SSH -> git remote add live ssh://user@server/path/to/deploy.git then git push live master
Content of the post-receive hook in the remote bare repo:
#!/bin/sh
GIT_WORK_TREE=/var/www/html git checkout -f
Everything works fine remotely, but I'd like to be able to deploy directly from the bare repo on the remote server. The next step will be a script called thru https to be able to deploy in case of SSH is unavailable.
Push on my local computer:
git push origin master:master To https://github.com/Myself/repo.git
d8856273..e3fe4b4c master -> master
On the bare repositery, before fetching
~/deploy.git$ git rev-parse --short HEAD
d885627
Fetching locally from remote server:
~/deploy.git$ git fetch https://github.com/Myself/repo.git master:master
From https://github.com/Myself/repo
d885627..e3fe4b4 master -> master
The new content is there. However, /var/www/html remains unchanged.
It seems that post-receive hook is not fired after fetching. How can I sort this out?