Execute PHP from GIT post-update hook
I am using GIT on my server and I am trying to get a PHP file to be executed each time I update my repo开发者_如何转开发sitory. I'm trying to use my post-update hook to achieve this.
this is the code I tried:
#!/bin/sh
echo
echo "**** Pulling changes into Prime [Hub's post-update hook]"
echo
cd $HOME/www || exit
unset GIT_DIR
git pull hub master
exec git-update-server-info
php /path/to/directory/file.php
I can't seem to get the PHP to execute. Anyone able to shine any light on this?
exec
never returns. Anything you put after the exec
call is dead code.
Remove the exec
, or place it before your php
line if that's the last thing that needs to be done. (And after doing error checking if necessary obviously.)
So for instance
...
git-update-server-info
exec php /path/to/directory/file.php
Or just simply
...
git-update-server-info
php /path/to/directory/file.php
(or move the statements around if your php script can be called before the git command.)
精彩评论