How to clone/pull from a Git repository using a webhook without creating a security risk?

35 Views Asked by At

I am trying to use a GitHub webhook to call a deploy script written in PHP that simply pulls the latest changes from the Git repository. However, this fails when the user owner of the website files that have to be updated is not the user running the web server (and PHP scripts). I've searched online for some help on how to do this but all tutorials seem to suggest changing the owner of the git repository and the deployment directory to the user running the web server. However, if I understand correctly, this is a security risk and is the reason why web servers run scripts using their own user instead that should only have read access to most files. Am I missing something and is there some way to use a webhook that pulls changes from a GitHub repository without causing a security risk?

0

There are 0 best solutions below