安装:yum install -y subversion
检查安装是否成功:svnserve --version
创建文件夹:mkdir /usr/local/svn/
创建版本库:svnadmin create /usr/local/svn/testsvn
passwd 文件:
[users]
testuser = testpwd
authz文件:
[groups]
dev = testuser
[testsvn:/]
@dev = rw
svnserve.conf文件:
authz-db = authz
password-db = passwd
启动SVN:
svnserve -d -r /usr/local/svn/
检查是否启动:
ps -ef | grep svn
关闭防火墙:
开启: service iptables start
关闭: service iptables stop
需重启
开启: chkconfig iptables on
关闭: chkconfig iptables off
配置代码自动部署:
cd /root/work
svn checkout svn://127.0.0.1/testsvn/Test Test
vim /usr/local/svn/testsvn/hooks/post-commit(赋予可执行权限)
#!/bin/sh
#======================================================================
export LANG=zh_CN.UTF-8
workspace=/root/work/Test
/usr/bin/svn update $workspace --username testuser --password testpwd --no-auth-cache
#======================================================================