On my server, I have two users, www-data (which is used by nginx) and git. The git user owns a repository that contains my website’s code, and the www-data user owns a clone of that repository (which serves as the webroot for nginx). I want to set up a workflow such that pushing to git‘s repository causes www-data‘s repository to update, thus updating my website.
What is the correct way to set up the hooks for these repositories (that also takes into consideration privileges and permissions of these two users)?
Remove the repository owned by
www-dataand follow the solution on this webpage for setting up a post-receive hook in the repository owned bygit.