I'm having a problem with allowing Apache to automatically have write access to an .htaccess file being pulled from a git repository.
Here's my process:
I'm logged in as a newly created user "webadmin", which has been added to the group "apache" (i'm on CentOS so it's equivalent to www-data) and I have created an empty directory:
/var/www/html/test
I've ensured that on this directory, i've done the following:
$ umask 002
$ chown -R apache:apache /var/www/html/test
$ chmod -R g+rw /var/www/html/test
This is to make sure that the directory is owned by the group "apache", and since my user "webadmin" is part of that group, I assume that anything I add with this user will also be writeable by the apache user (php scripts).
Still using the webadmin user, I then run a
git clone myrepo.git .
Which pulls my WordPress website files down into the directory. Included in this is an .htaccess file. This file needs to be writeable by WordPress, so that it can modify rules. All files pulled down are owned by webadmin with the group of apache.
For whatever reason, the .htaccess file is not by default writeable by apache until i again run:
$ chmod -R g+rw /var/www/html/test
Why would I have to run this command again? Is there any way I can make it so that this file can but automatically written to by apache when it's pulled down without having to run the -R g+rw
command?