目標: 將當前已使用的Centos的svn(subversion)版本庫 備份到 Windows Server 環境Visual SVN中
源(Centos)服務器地址:svn://192.168.1.1/svn/srcA
備份(Windows Server)服務器地址:svn://192.168.1.2/svn/destA
-
windows環境建立鏡像版本庫
1 2 3 4 5 6 7 |
啓動版本庫 |
-
初始化鏡像庫(在源服務器上)
1 |
#svnsync init 目的可訪問地址 源版本庫服務器地址
|
-
同步
1 2 |
|
-
解鎖
1 2 |
|
- 1、在要備份的機器上建立版本庫:
- 2、進入hooks目錄:cd A/hooks/
- 3、創建pre-revprop-change文件:cp pre-revprop-change.tmpl pre-revprop-change
- 4、修改pre-revprop-change權限:chomd +x pre-revprop-change
5、修改文件:vi pre-revprop-change
爲 echo “Changing revision properties other than svn:log is prohibited” >&2
exit 0(1修改爲0) - 6、同步初步(在):
svnsync init svn://192.168.1.2/svn/destA svn://192.168.1.1/svn/srcA
svnsync: Destination repository is already synchronizing from ’svn://10.10.10.1′ - 7、實現同步:
svnsync sync file:///home/test/svn/test –username username –password password1
在源庫的hooks下面,添加post-commit 腳本
可拷貝post-commit.tmpl即 :cp post-commit.tmpl post-commit
然後把 post-commit 中,最後兩行替換爲
svnsync sync --non-interactive svn://192.168.1.205/mu --sync-username user --sync-password user
即提交更新後,即執行同步命令,不進行交互
把post-commit 設爲755權限。