I have a repo on my machine, MyApp
, I have a Bare Git Repo on a remote server production
at /home/userName/MyApp
.
When pushing to remote production
, I need to update the code in the actual location /var/www/MyApp
, but it needs root/sudo permission.
In the bare repo, add file /home/userName/MyApp/hooks/post-receive
. This file is always executed after a push.
The idea is to execute this:
#!/bin/bash