diff --git a/php/upload.php b/php/upload.php index c4a20bc..c1e955a 100755 --- a/php/upload.php +++ b/php/upload.php @@ -76,10 +76,14 @@ } function push_to_git() { - $git_cmd = 'git --git-dir=/var/www/src/aliceclass'; - shell_exec($git_cmd . ' add /var/www/src/aliceclass/_data/aulas.json'); - shell_exec($git_cmd . ' commit -m "update data"'); - shell_exec($git_cmd . ' push'); + $git_cmd = 'cd /var/www/src/aliceclass; git '; + + shell_exec($git_cmd . ' config user.name www-data 2>&1'); + shell_exec($git_cmd . ' config user.email www-data@noreply.alice 2>&1'); + + shell_exec($git_cmd . ' add /var/www/src/aliceclass/_data/aulas.json 2>&1'); + shell_exec($git_cmd . ' commit -m "update data" 2>&1'); + shell_exec($git_cmd . ' push 2>&1'); } $username = $_SERVER['PHP_AUTH_USER'];