I have been battling with this for days now... each time I do git push live master (using git post hook) ... Remote file permissions and ownership are being changed every time back to the default which would make pages on the website throw a 500 error. I usually get around this by running sudo chown -Rf www-data:www-data /var/www/<Website-Root-Folder> but I want this permanently fixed, so I don't have to do this every time.
I have done the following, which I found here: Permissions with Git Post-Receive
sudo usermod -a -G www-data root // As I'm doing my push using the root user.
Sorry, I'm new to git, linux, Not sure what else to do. Any help in making this work without me having to run this sudo chown -Rf www-data:www-data /var/www/<Website-Root-Folder> after every push will be highly appreciated.
Thanks