美文网首页
GIT自动部署WEB代码

GIT自动部署WEB代码

作者: lemon_jun | 来源:发表于2018-11-06 11:23 被阅读0次
    在安装git时候创建了用户组

    1、创建git仓库 例:cd /home/git && mkdir shuchong.git
    2、初始化仓库 cd shuchong.git && git init --bare
    3、修改conf文件配置信息 vim conf (好吧 下面配置我也不甚了解怎么个意思)

    [core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
        #项目目录
        worktree = /html/shuchong
    
    [receive]
        denycurrentbranch = ignore
    

    4、修改hooks 目录 post-receive文件 cd /home/git/shuchong.git/hooks && vim post-receive

    #!/bin/sh
    #unset GIT_DIR
    #cd /html/shuchong
    #git pull
    echo "=> update source code to the latest"
    git checkout -f
    

    5、保证我们的服务器web目录有git操作权限 chown git:git /html/shuchong
    6、在客户端测试、push 一个文件即可~

    客户端 服务端
    日常心里博弈

    三好君:学习嘛~还是要继续哒 不能弃 不能弃~ 学而时习之 %%$##@*
    贫道:这日子没法过了~ (╯°□°)╯︵ ┻━┻
    三好君:造反呀~ 不吃饭 不缴房租 不找媳妇啦~
    贫道:emmmm~ 我在瞧瞧这段代码啥意思来着 啧啧 真实用~
    三好君:呸~

    相关文章

      网友评论

          本文标题:GIT自动部署WEB代码

          本文链接:https://www.haomeiwen.com/subject/nqwqxqtx.html