CentOS 7 搭建SVN服务器

一、安装

yum -y install subversion

二、配置

1. 建立仓库
mkdir -p /home/svn/repos
svnadmin create /home/svn/repos/
cd /home/svn/repos/conf
2. 添加用户
vi passwd

添加 test = 123456

3. 添加用户权限
vim authz

添加

[/] 
test = rw
4. 配置
vim svnserve.conf

修改

anon-access = none 
# 授权用户可写
auth-access = write
# 使用哪个文件作为账号文件
password-db = passwd 
# 使用哪个文件作为权限文件
authz-db = authz 
# 认证空间名,版本库所在目录
realm = /home/svn/repos
5. 启动
# 启动svn版本库
# svnserve -d -r /home/svn
svnserve -d -r /home/svn/repos

# 停止SVN命令
killall svnserve

三、钩子

钩子配置

cd ../hooks/
cp post-commit.tmpl post-commit
chmod +x post-commit
vim post-commit

钩子脚本修改

WEBPATH="/home/wwwroot/test/" # 网站目录
export.UTF-8
svn update $WEBPATH --username username --password password --no-auth-cache

拉取文件

svn co svn://127.0.0.1/ ./

拉取单个文件

# 进入目录
svn up laravel.log

你可能感兴趣的:(linux)