Some functionalities require new folders in my application and sometimes I need to grant write permissions to those folders.
At the moment, when I upload the code to production environment, I need to manually grant those permissions in the server. When another person at my development team pulls my code through git, they have to manually grant it locally in their machines.
What is the best practice to grant those permissions automatically in both cases?
I don't know if that interferes in something but the application is written in PHP using Zend Framework2. We use composer for dependency management and Git for versioning.
Edit 1
So I've heard about Git Hooks. I want to create a post-receive hook
to be executed everytime my remote repository receives commits and a post-merge hook
to be executed at every developer machine after they execute git pull.
I've also heard that hooks are not transfered through commits from developer-to-server and vice-versa.
Is that true? Do I need to create a specific script in my code (which is commited) and then refer it in those hooks?