1

I realize there are many posts regarding this but I suspect part of the issue is that I might not be running apache correctly.

Before looking at core.filemode do I first need to get both my local and server files/directories using the same user/group?

I've read something about running apache as a user for example - is this a better way of setting things up?

tshepang
  • 12,111
  • 21
  • 91
  • 136
CMSCSS
  • 2,076
  • 9
  • 28
  • 49
  • http://stackoverflow.com/questions/6210116/git-deploying-project-file-permissions-chmod could help here. – VonC Jun 29 '12 at 06:22
  • I set that git file config globally but when I view on the server, the permissions have changed to 755. What do you put in the post receive hook to chmod the directories? Also, my bare git repo is publicly assessable as it's in the web root - I tried blocking with a .htaccess (and reloading apache) but can figure it out sorry. – CMSCSS Jun 29 '12 at 09:22
  • Ok, just checking if you could use the `chmod` command in your hook to modify appropriately the permission of the destination. – VonC Jun 29 '12 at 09:30
  • How do I do that? Do I just add `chmod 664 /path/to/file` in the hook? Sorry, I'm not super familiar with how to put commands into the hook (I just followed a tutorial to get it to copy), then make it executable? – CMSCSS Jun 29 '12 at 18:11
  • Yes, the hook itself is just a script, so you can add any command you want. Actually, you can test that script by running it directly. – VonC Jun 29 '12 at 18:52
  • So have been trying to chod the directories by adding `chmod 664 /path/to/directory` into the post-receive hook and re-made it executable - do I need to do that each time I edit the file? Have also ensured there are local changes so there is something to commit - but no luck sorry. Just don't understand why it's not working. – CMSCSS Jun 29 '12 at 19:02
  • 1
    I think the question I mention (http://stackoverflow.com/questions/6210116/git-deploying-project-file-permissions-chmod) is there to comment on the fact that files can only be `644` or 755`. Ie *not* writable for group or other. `chmod` would work if the hook os executed by root, and it would need at least `775` or `777` to make sure for the checkout to succeed. But if not, then yes, Apache should be run as a user compatible with the one executing the hook. That way, no `chmod` involved at all. – VonC Jun 29 '12 at 20:48

0 Answers0