Apache permission issues while deploy Kirby with GIT

There a scripts around like this one: Script that changes the permissions

But how to to it automatically with a post-receive hook or similar?