E
E
edik892016-09-26 21:37:44
git
edik89, 2016-09-26 21:37:44

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

2 answer(s)
E
edik89, 2016-09-27
@edik89

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.

R
romy4, 2016-09-26
@romy4

does git status work?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question