Solved.
My post-receive hook is as follows:
#!/bin/sh
echo "Deploying to http://dev.example.com"
GIT_WORK_TREE=/home/example/domains/example.com/public_html/dev git checkout -f
cd /home/example/domains/example.com/public_html/dev
find -type f -group 'git' -exec chmod 644 -R {} \;
find -type d -group 'git' -exec chmod 755 -R {} \;
This will work as long as there are no writable directories needed. Otherwise I have to add them as extra chmod lines to the hook script