First time using git to push to a web server. Thanks to this, it works.
Mostly as a record for myself, here’s how I set it up.
Starting on the web server:
chmod g+s .
git config receive.denyCurrentBranch ignore
Then add the following to
env -i git reset --hard
chmod +x .git/hooks/post-receive.
Finally, on my local machine:
git remote add web user@host:/path/to/foo/.git/
git push web master
This works on Ubuntu because the default umask is
0002. Umasks are set per user / process, not on the filesystem, so if you have a umask problem, you’ll have to solve it!