我这边也是同样的问题
而且日志也打印出来了,但是还是不能更新
hook代码
$target = '/var/www/myBlog'; // 生产环境web目录
$token = 'fifi1993';
$json = json_decode(file_get_contents('php://input'), true);
if (empty($json['token']) || $json['token'] !== $token) {
exit('error request');
}
Log::info("POST token 验证成功");
$cmd = "sudo -Hu www cd $target && git pull";
Log::info($cmd);
shell_exec($cmd);
Log::info("shell 命令行执行成功");
输出的日志:
[2017-04-21 10:49:28] local.INFO: POST token 验证成功
[2017-04-21 10:49:28] local.INFO: sudo -Hu www cd /var/www/myBlog && sudo -Hu www git pull
[2017-04-21 10:49:28] local.INFO: shell 命令行执行成功