I'm wondering if anybody includes a better technique for this.
I'm presently hosting my very own remote git repo on a single box because the webserver.
All git repos they are under the git user.
sudo -uwww-data -gwww-data git --git-dir=/var/www/website/.git --work-tree=/var/www/website pull
I've got a cron job running as root every minute that executes this command. The git repo within the web folder is cloned in the same box to git's home dir where it's saved rather than through ssh.
So my question: Since git does not own the net files, it cannot slowly move the site utilizing a git hook. I'd assume I'm not going git to possess sudo, nor would that actually work using a git hook, right? Can there be something which will deploy the website faster than every minute? I'm not going the operation to be really costly.
Can there be some type of daemon root could run and listen for many type of notification? Like getting it watch a file's last modified time?
Observe that this article (in French, translated through Google) reviews that sudo works together with your approach:
sudoto permit the
gitosisuser to make use of this command as
To get this done, by running "visudo" add the road:
git ALL = (www-data) NOPASSWD: /usr/local/bin/pullhere
Then, in every repository where necessary, add the following hook inside a
sudo -u www-data /usr/local/bin/pullhere /html/u/user/here