Answer the question
In order to leave comments, you need to log in
Why doesn't git commit work in shell_exec()?
You need to run the git command from a php script. Other commands work fine, namely commit does nothing and doesn't output anything.
That is, if I do:
$git_branches = shell_exec('git add ../'.$_GET["FILE"]);
$git_branches = shell_exec("git commit -m '".$_GET["COMMIT_TITLE"]."'");
$git_branches = shell_exec("cd ".$_SERVER["DOCUMENT_ROOT"]." && ls -la && git commit -m '".$_GET["COMMIT_TITLE"]."'");
pre($git_branches);
Answer the question
In order to leave comments, you need to log in
For debugging, you should use the following scheme:
That is, we change shell_exec to exec, and add "2>&1"; Then we can see the errors.
The commit command itself did not work, because the user was incorrectly specified in the config. And because the user did not have enough rights. Made him the owner of the .git folder. Problem solved
$git_branches = shell_exec('git commit -m "'.$_GET["COMMIT_TITLE"].'"');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question