SVN項目備份android
使用svnadmin工具導出到本地。ios
cd H:\Repositoriesshell
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。vim
centos 7 SVN安裝與配置centos
1.安裝
yum install subversion
版本:svnserve -versionbash
2.建立svn版本庫,以test 庫項目爲例。ide
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文件svn
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。