1、打开仓库设置中的管理git钩子,通过配置post-receive(提交后执行)来进行自动代码更新,并自动clone项目
2、在钩子文本中配置,之后每次push提交都会被触发
3、#!/bin/bashroot_path='/www/xiaochengxu/project'unset $(git rev-parse --local-env-vars);mkdir -p $root_pathcd $root_path;git clone [email protected]:xiaochengxu/project.git $root_pathif [ $? = 0 ]; then chown -R 1000:100 $root_path && chmod -Rf g+s $root_path && chmod -R 775 $root_pathfigit checkout .;git pull origin master;
4、最终代码自动生成到指定的root_path目录