簡單利用coding結合git實現webhook
1.創建webhook.php
確保服務器上能以ssh方式進行git pull操作
確保shell_exec能執行,在php.ini中 disable_functions 中去掉 shell_exec
<?php
$pwd = getcwd();
$command = 'cd ' . $pwd . ' && git pull';
$output = shell_exec($command);
print $output;
?>
2.設置權限
linux服務器上項目默認權限是root用戶,而用戶訪問webhook.php的權限是www,www是沒有權限執行git pull操作的,所以需要改變項目所有者權限
chown -R www:www catalogue
3.coding配置webhook設置