I'm using Windows
/ PHP
.
By using a PHP
script I wanna make a commit
but this operation fails.
For this I'm using the following code:
<?
$command = "git commit -am .";
shell_exec($command);
?>
I also tried using chdir
to be sure I'm in the Git repository directory but it doesn't work (anyway I think I don't need chdir
. The problem is another thing).
Normally from the Windows console
I use the same command above (which works perfectly):
> git commit -am .
Also, if from the Windows console I do:
> php myscript.php
it works properly. But if through the browser I go to the url:
http://localhost/mysite/myscript.php
Then, the commit doesn't go thru. But as I said you before, the status is read properly from the browser.
In the other hand, if I just check the status
by doing:
<?
$command = "git status";
$output = shell_exec($command);
echo $output
?>
Then the Git status
is returned correctly.
Any idea on how to make the commit
works through PHP
on Windows
?
[EDIT 1]
I checked the Apache error log and I saw that everytime I tried to do a commit there was an error saying that I need to specify email and name. Then I did that (via PHP too). But now I'm getting another error, which says: fatal: Paths with -a does not make sense. (on the Apache error log) when I try to make the following commit via PHP: shell_exec("git commit -am 'my commit message here'");. Do you know what to do now?