You should be running the web server as a user other than root. Lets assume 'www'. You develop on another machine, and push to a shared repo where the live server also pulls from. However, you will probably log into the server as root or yourself instead of www, yet if you work with files, use git, etc… permissions can get messed up, even if you tell git to ignore permissions in the config file.
git config core.sharedRepository group
git init –shared=group
I personally disable filemode checks by git since I work across Unix, Mac, and Windows environments. Rather, I set up group sticky bits and umask 2.
git config core.filemode false
chgrp -R <whatever group> gitrepo
chmod -R g+swX gitrepo
chmod -R g+rw . 2>/dev/null