多语言展示
当前在线:1204今日阅读:11今日分享:19

gogs配置钩子脚本,代码自动更新

gogs配置钩子脚本,代码自动更新,自动clone项目代码
工具/原料

gogs 0.11.97.1209

方法/步骤
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 git@ssh.gogs.com: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;

注意事项
1

需要配置root_path的项目路径

2

需要配置git项目地址

3

chown -R 1000:100 $root_path为修改项目目录的所属人1000和所属组100

推荐信息