Issue
On a CentOS 6.3 server with WHM/cPanel:
When uploading files directly, I can access them in my browser just fine, but when I git pull them from the repository, they download but I can't access them (500 Internal Server Error).
I thought it was an ownership problem (on Ubuntu I used to set www-data as the owner), but from what I can see there is no apache user here, the files are run as the user itself. First thing when I git pull the files they have 644 permission (folder is 755, but files are 644).
Any idea how i can make git make them 755 on git pull?
Solution
The easiest thing to do is to commit them with the proper permissions in the first place. Git should detect you changing the mode from non-executable to executable. If you're on an OS that lacks an execute bit - say, Windows - you can tell git to add the execute bit manually:
git update-index --chmod=+x filename
Answered By - Edward Thomson