So far it has not been possible to understand this. I saw several answers, but none of them help.
I'm trying to use Github Webhooks so that github hits the url on my server and the server pulls out the newly committed elements as soon as it hits. I have a php script with the following:
<?php `git pull git@github.com :my-user/myrepo.git`; ?>
However, that script when hit is run as an apache user, so I tried:
chown -R apache:apache .
and he still has an error resolved with permission.
So, I tried to edit the sudoers file and changed the following:
Host_Alias LOCAL=127.0.0.1 apache LOCAL=NOPASSWD: /var/www/html/git-hook.php
and it still doesn't work.
How can I do that? If I run:
sudo php git-hook.php
It works fine, so nothing happens with the code in the php file. I just want it to be automated.
Any ideas?
Edit:
I also forgot to mention. I even created the folder /home/apache/.ssh and copied the public key to migrate git to the same result.
Peter source share