I'm trying to make git auto deploy to different directories depending on a branch that was pushed. I have a remote bare repository, local repository and two directories where I whant the data to be deployed and updated with each push from local to remote repository. I've added post-update hook:
#!/bin/sh
echo $1
echo "*UPDATE*"
case " $1 " in
*'refs/heads/develop'*)
GIT_WORK_TREE=/home/git/public_html/example_deploy_dev git checkout develop webroot
echo
echo "Dev was pulled"
echo
;;
esac
case " $1 " in
*'refs/heads/master'*)
GIT_WORK_TREE=/home/git/public_html/example_deploy git checkout master webroot
echo
echo "Master was pulled"
echo
;;
esac
It deploys just fine on first file creation, but doesn't update it when it's changed in directories which shold be deployed. Where do I miss smth? Thanks!