上传自己的hooks文件run.php$target = '/www/web/test.adophper.com';
echo "Startn";
echo shell_exec("whoami");//查看真实用户很重要
$json = json_decode(file_get_contents('php://input'), true);
try {
if (isset($json['password']) && $json['password'] == 'xxxxxx') {
$res = shell_exec("cd $target && git pull");
echo date('Y-m-d H:i:s') . ",Updatedn";
print_r($res);
echo "n";
} else {
echo "Password Errorn";
}
echo "Endn";
}catch (Exception $e) {
print_r($e);
}
这里的页面就根据自己需求修改了。