I am wondering if anyone has a better strategy for this scenario.
I currently have my own remote git repository in the same field as the web server.
All git repositories are under the git user.
sudo -uwww-data -gwww-data git --git-dir=/var/www/website/.git --work-tree=/var/www/website pull
I have a cron job running as root every minute that runs this command. The git repository in the web folder is cloned from the same field to git home dir, where it is stored instead of ssh.
So my question is: since git does not own web files, it cannot move the site using git hook. I would suggest that I don't want git to have sudo, and that doesn't work with git hook, right? Is there something that will deploy the site faster than every minute? I do not want the operation to be very expensive.
Can some root of the daemon run and listen to some kind of notification? How to view the file last modified time?
source share