I'm trying to set up git on my VPS for the first time. I'm also using Virtualmin. Everything is installed and works well when I use root to push, but I obviously don't want to do that. The problem is, if I try to set up my 'git' user to push to my public_html directory, I get the following error:
remote: fatal: Could not switch to '/path/to/': Permission denied
error: unpack failed: unpack-objects abnormal exit
I'm assuming this is because my git user doesn't have permission to access the folder in which the public_html folder lives. Is there something I can add to my post-receive hook to call sudo or something else so that I don't have this problem. (Sorry, I know this is probably a super easy question, but this is my first time setting it up myself and I couldn't find a good answer through search).