2

I have been noticing that when I pull changes to my server that it automatically adds group write access to the files that are changed. However since I am using suPHP that causes a 500 error, so I am needing to disregard any permissions and ownership that the Git repo may have and replace it with the proper permissions that the folder itself has.

EDIT: suphp requires maximum permissions of 644 for files and 755 for directories, to help protect the user's files from modification. It is a patch to PHP that works wit Suhosin.

I work with a localhost environment, push to staging and that is when I get the errors because staging is a clone of the production environment.

OpensaurusRex
  • 842
  • 1
  • 12
  • 30
  • unless you are checking out and editing directly on a production environment, you aren't doing that are you??? Why are you using `suphp` on a development machine, it is designed to help secure a production deployment? –  Mar 09 '12 at 19:29
  • No I edit on a dev environment then the staging environment and I use git to push to server, however it causes issues with the permissions. – OpensaurusRex Mar 09 '12 at 19:49
  • I don't quite get what you want since I know nothing about suPHP, but you can always use [git hooks](http://book.git-scm.com/5_git_hooks.html) to set desired permissions after you push to the repo. – dmedvinsky Mar 09 '12 at 19:12
  • suphp is a patch for php that requires that the user have 644 for files (or less) and 755 for directories. It keeps other groups and users from being able to access and modify your files. I don't remember what else it does, but it tends to be a pain when I am having to run a command to fix permissions. – OpensaurusRex Mar 09 '12 at 19:22

2 Answers2

2

I think that git honor umask. So simply set it to 0022 or stricter before using any git command, and you should be fine.

$ umask 0022
$ git checkout master
Sylvain Defresne
  • 42,429
  • 12
  • 75
  • 85
0

I ended up using the post-merge hook and running a chmod -R g-w . in a bash script. This helped make sure that it never added any other write files that would cause the server to 500 error out.

OpensaurusRex
  • 842
  • 1
  • 12
  • 30