在Linux下安装SVN并配置post-commit

步骤1:安装svn服务器
    1.1修改网卡能够上网
    vi /etc/sysconfig/network-scripts/ifcfg-eth0
    DEVICE=eth0
    ONBOOT=yes
    BOOTPROTO=dhcp

    service network restart #重启网卡服务
    1.2 安装svn服务器
    yum -y install subversion

步骤2:创建shop仓库 并 配置
    2.1 创建shop仓库
    mkdir -p /svn/cangku
    svnadmin create /svn/cangku/shop
    2.2 配置
    vi /svn/cangku/shop/conf/svnserve.conf
    #去注释
    anon-access=none
    password-db=passwd
    authz-db = authz

    vi /svn/cangku/shop/conf/passwd
    #添加用户
    user1=666666

    vi /svn/cangku/shop/conf/authz
    #设置权限
    [shop:/]
    user1=rw

步骤3:开启svn服务
    svnserve -d -r /svn/cangku

步骤4:本地检出测试
    本地通过【svn://服务器ip地址/shop】检出测试 (在Linux服务器service iptables stop关闭防火墙或开放3690端口)

步骤5:配置post-commit
    5.1 创建post-commit文件
    cd /svn/cangku/shop/hooks
    cp -r post-commit.tmpl post-commit

    vi post-commit
    #添加如下配置
    REPOS="$1"
    REV="$2"
    export LANG=zh_CN.UTF-8
    #下行注释掉
    #mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf
    #svn update 自动检出的目录 --username 用户名 --password 密码 --no-auth-cache
    svn update /php/wwwroot/shop --username user1 --password 666666 --no-auth-cache
    5.2post-commit所有用户可执行权限
    chmod -R a+x post-commit

步骤6:开发服务器第一次检出下
    mkdir -p /php/wwwroot/shop
    cd /php/wwwroot/shop
    #第一次检出(手动)
    #svn co svn://服务器ip地址/shop /svn/wwwroot/shop
    svn co svn://192.168.142.128/shop /php/wwwroot/shop

步骤7:本机提交测试

猜你喜欢

转载自blog.csdn.net/csdn_heshangzhou/article/details/82532253
今日推荐