A
A
anboo2016-02-09 11:42:17
PHP
anboo, 2016-02-09 11:42:17

How to do git pull from PHP or webhook for bitbucket?

I have the following code:

echo shell_exec('cd ' . $dir . ' && /usr/bin/git pull origin HEAD');

If I run it from the VPS console - everything works fine.
If I run purely from nginx (well, through the address bar) - it does nothing.
In general, I implement a web-hook for BitBucket to do git pull origin HEAD when I uploaded changes to the branch from the local computer.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2016-02-09
@Sanasol

The webserver does not have permission to run/write files from the .git folder

A
Aleksey Ratnikov, 2016-02-09
@mahoho

To remove the notorious comment prompt, use the -m switch:

echo shell_exec('cd ' . $dir . ' && /usr/bin/git pull origin HEAD -m "Merge with origin"');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question