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

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

东西/原料

  • gogs 0.11.97.1209

方式/步调

  1. 1

    打开仓库设置中的办理git钩子,经由过程设置装备摆设post-receive(提交后执行)来进行主动代码更新,并主动clone项目

  2. 2

    在钩子文本中设置装备摆设,之后每次push提交城市被触发

  3. 3

    #!/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;

  4. 4

    最终代码主动生当作到指定的root_path目次

注重事项

  • 需要设置装备摆设root_path的项目路径
  • 需要设置装备摆设git项目地址
  • chown -R 1000:100 $root_path为点窜项目目次的所属人1000和所属组100
  • 发表于 2020-01-01 17:00
  • 阅读 ( 1583 )
  • 分类:其他类型

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
联系我们:uytrv@hotmail.com 问答工具