I've followed the example listed at this site in remotely adding my files to my server, however, I'd like to have all files owned by the nginx:nginx
user:group so that I can access the files from my browser after pushing the files.
How do I go about amending the post-receive
hook so that nginx:nginx
becomes the owner of the files/folders pushed to the remote 'ubuntu` server?
I've tried the following post-receive
hook, however, if the file is being amended I receive the error: remote: error: unable to unlink old 'index.html' (Permission denied)
, shell script here:
#!/bin/sh
GIT_WORK_TREE=/var/www/www.foo.com/htdocs
export GIT_WORK_TREE
git checkout -f
exec sudo chown -R nginx:nginx $GIT_WORK_TREE
Thanks advance for any help!