Here's the scenario:
There is a Git repo, which is tracking website files, including the .htaccess
at root. The Git repo is checked out to a staging site and to a production site.
The problem: The staging site has to be protected with password (through htpasswd authentication). This changes .htaccess
file as well. Now committing or pushing from staging environment means the .htaccess
file (which enables password-protection for root directory) is checked-out to the live website as well, making the live website ask for password as well.
Now how shall I go about it? Should I stop tracking .htaccess
? Should I overwrite .htaccess
through post-receive hook (possible? how?)? Is there any other way to protect a directory without modifying .htaccess
? Any other solution?