SVN项目备份
使用svnadmin工具导出到本地。
cd H:\Repositories
svnadmin dump H:\Repositories\test > F:\svn_dump\test.dump
svnadmin dump H:\Repositories\android > F:\svn_dump\android.dump
svnadmin dump H:\Repositories\BackEnd > F:\svn_dump\BackEnd.dump
svnadmin dump H:\Repositories\DevOps> F:\svn_dump\DevOps.dump
svnadmin dump H:\Repositories\ios > F:\svn_dump\ios.dump
svnadmin dump H:\Repositories\pigcms > F:\svn_dump\pigcms.dump
svnadmin dump H:\Repositories\Product > F:\svn_dump\Product.dump
svnadmin dump H:\Repositories\UI > F:\svn_dump\UI.dump
svnadmin dump H:\Repositories\wechat > F:\svn_dump\wechat.dump
svnadmin dump H:\Repositories\WorkLogs > F:\svn_dump\WorkLogs.dump
通过ftp工具将如上dump文件上传到centos7,并将用户和组权限文件group.conf 和 htpasswd拷贝上传到centos。
centos 7 SVN安装与配置
1.安装
yum install subversion
版本:svnserve -version
2.创建svn版本库,以test 库项目为例。
mkdir -p /workstation/svn_code/Repositories\test
svnadmin create /workstation/svn_code/Repositories\test
svnadmin create /workstation/svn_code/Repositories\android
svnadmin create /workstation/svn_code/Repositories\BackEnd
svnadmin create /workstation/svn_code/Repositories\ios
ls /workstation/svn_code/Repositories\test ##生成版本库Repositories文件
3.配置svn信息
cd /workstation/svn_code/Repositories/test/conf
vim authz
在[ group ] 组下添加用户组
admin = admin
在 [project:/] 添加用户组权限
@admin=rw //其中@ 表示对于用户组,* 表示全部用户
vim passwd
[users] 配置用户名和密码
admin = admin123
vim svnserve.conf
取消以下注释:
anon-access = read
auth-access = write
password-db = passwd
authz-db = authz #访问控制文件
realm = project #认证命名空间
vim /root/.subversion/servers
修改为:store-plaintext-passwords = yes
确认安装openssl 与 openssl-devel
yum install openssl openssl-devel
4.svn启动,连接
启用:svnserve -d -r /workstation/svn_code/Repositories
连接:
svn import提交一不在版本控制下的树或文件到版本库。未将版本化的文件导入到版本库。
svn import project svn://IP/project/ -m "admin"
导入备份文件
命令:
svnadmin load /workstation/svn_code/Repositories/test < /home/svn_bak/test.dump
svnadmin load /workstation/svn_code/Repositories/android < /home/svn_bak/android.dump
svnadmin load /workstation/svn_code/Repositories/BackEnd < /home/svn_bak/BackEnd.dump
svnadmin load /workstation/svn_code/Repositories/DevOps < /home/svn_bak/DevOps.dump
svnadmin load /workstation/svn_code/Repositories/ios < /home/svn_bak/ios.dump
svnadmin load /workstation/svn_code/Repositories/pigcms < /home/svn_bak/pigcms.dump
svnadmin load /workstation/svn_code/Repositories/Product < /home/svn_bak/Product.dump
svnadmin load /workstation/svn_code/Repositories/UI < /home/svn_bak/UI.dump
svnadmin load /workstation/svn_code/Repositories/wechat < /home/svn_bak/wechat.dump
svnadmin load /workstation/svn_code/Repositories/WorkLogs < /home/svn_bak/WorkLogs.dump
批量导入,脚本shell
#!/bin/bash
DIR_HOME="/home/svn_bak"
SVN_HOME="/workstation/svn_code/Repositories"
files=`cd $DIR_HOME;ls`
pro="test android BackEnd DevOps ios pigcms Product UI wechat WorkLogs"
for file in $files;
do
#get all *dump files
project=`echo $file | sed -n ‘/.*\.dump/p‘ | cut -d ‘.‘ -f1`
if [ "$project"x != ""x ];then
if [ "$project" = "$pro" ];then
continue
fi
create_dir="svn create $SVN_HOME/$project"
svn_load="svnadmin load $SVN_HOME/$project < $DIR_HOME/$project.dump"
execute create_dir order
echo $create_dir
eval $create_dir
execute svn_load order
echo $svn_load
eval $svn_load
fi
done
客户端代码检出测试
Windows客户端 TortoiseSVN checkout。
原文地址:https://blog.51cto.com/10874766/2355820