In the remote server I have a post-receive hook set up in order to make a git checkout of my repository:
#!/bin/sh
GIT_WORK_TREE=/var/www/ git
This is an old question, but this may help Mac users.
If you are copying files from Time Machine manually, instead of restoring them through Time Machine, it'll add ACLs to everything, which can mess up your permissions.
For example, the section in this article that says "How to Fix Mac OS X File Permissions" shows that "everyone" has custom permissions, which messes it all up:
You need to remove the ACLs from those directories/files. This Super User answer goes into it, but here's the command:
sudo chmod -RN .
Then you can make sure your directories and files have the proper permissions. I use 750 for directories and 644 for files.