php实现webhook自动部署代码


 

 

 

简单利用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 catalogue 

 

3.coding配置webhook设置


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM