Answer the question
In order to leave comments, you need to log in
How to run git pull from a shell script?
I'm trying to set up a hook that would run a git pull command to deploy to a test server after pushing to a GitLab repository. Faced with the fact that the git pull command is not executed if it is run from a shell script using php, i.e. I used the following construction: exec('sh .hooks/gitlab-webhook-push.sh')
The exec command itself works and if, for example, I try to execute the whoami command in the gitlab-webhook- push.sh, then everything works. The problem is precisely with the fact that the git pull command does not work. If I execute it from the console, then everything works. Has anyone come across?
Answer the question
In order to leave comments, you need to log in
The problem was precisely that the script was run from under www-data and it was necessary to generate separate keys for ssh for this user.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question