Here is what I have on an Ubuntu Server 16.04 LTS:
- I'm hosting a static website (build using https://gohugo.io/) on a private github repo
- I created a Webhook.php on my Webserver that is called by github ever time the repo gets a push (from https://gist.github.com/cferdinandi/e6e4e05c4b25e322db4eb1f1998523ac)
Webhook.php runs in my Nginx and shall do the following:
- Pull the latest changes from github
- Cd into the folder of the local repo
- Run Hugo
- Copy the built website to /var/www/website
My problem is that I have a mess with permissions
- Webhook.php runs as www-data
- but only my user1 currently has the ssh key to get access to the github repo
- Www-data is a no-login user. So I’m not really sure whether I can actually give it an SSH key.
- My original plan was to have the repo checked out under /home/user1/repo but this is tricky as www-data has no permissions there
In short: I’m in permission hell and I could use some suggestions on what to put where, how to adjust permissions and which direction to go int.