打开仓库设置中的办理git钩子,经由过程设置装备摆设post-receive(提交后执行)来进行主动代码更新,并主动clone项目
在钩子文本中设置装备摆设,之后每次push提交城市被触发
#!/bin/bash
root_path='/www/xiaochengxu/project'
unset $(git rev-parse --local-env-vars);
mkdir -p $root_path
cd $root_path;
git clone git@ssh.gogs.com:xiaochengxu/project.git $root_path
if [ $? = 0 ]; then
chown -R 1000:100 $root_path && chmod -Rf g+s $root_path && chmod -R 775 $root_path
fi
git checkout .;
git pull origin master;
最终代码主动生当作到指定的root_path目次
0 篇文章
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!