We have spent too many hours now trying to get an automated git pull happen on our server.
What we try to accomplish: Code in our local environment and push to our Gitlab server. The gitlab server executes a webhook to a .php file that shall run a script updating our live server with the commited files.
The problem we have is that it never updates the files. We have tried a lot of things now and starting to get out of ideas, so hopefully someone here can shred some light.
We are using this script https://gitlab.com/kpobococ/gitlab-webhook/blob/master/gitlab-webhook-push.php
Our folder structure is:
----- htdocs (project folder)
We edit the .php file to point to the hooks folder and the .sh file to cd …/htdocs > /dev/null &
Running the webhook the log gets updated but the git pull doesn’t seems to work. So the webhook seems to be correct.
If we using the cmd line on the server using git pull the files gets pulled. So that would suggest that git is initialized correctly. But worth mentioning is that when we initialized and cloned we used the http url instead of the ssh, if that might be a problem? We have cached the username and password on the server also.
We are using Bitnami image for Gitlab server and a Bitnami Prestashop image for our “production” server. On our local machines we have downloaded a Bitnami Prestashop image.
Something worth mentioning is that our server already had files inside our project folder in which we initialized git, in case that can be a problem.
What we would think being the problem is permissions. The apache user that runs the script is daemon. But we have given daemon full access on all files and nothing.
But since we can get any error messages worth mentioning it’s hard to know where the problem is.
So hopefully someone here can point us in the right direction or point out something we should have done differently in our setup that might cause problems.