close
第一次做svnsync已經是一年半前的事, 今天剛好又來一個需求趕快趁機紀錄一下!!
原始svn site為 svn1:/svnroot
共同的 svnsync 帳號為 syncuser (注意:此帳號需有所有檔案的讀取權限)
1. 在新server(svn2)建立新的svn repository
svnadmin create /mirror/svn
2. 在hooks目錄建立一個新檔案"pre-revprop-change"並將permission設為可執行
pre-revprop-change內容類似:
#!/bin/sh
if [ "$3" = "guest" ]; then exit 0; fi
echo "Only the syncuser can do the svnsync" >&2
exit 1
3. 初始化 mirror site 的repository
svnsync init --username syncuser --password xxxxxx svn://svn2/mirror/svn svn://svn1/svnroot
4. 開始將資料 sync 到 svn2 上
svnsync sync --username syncuser --password xxxxxx svn://svn2/mirror/svn
待第一次 sync 完成後在 svn1 的 hooks 目錄的 post-commit 檔案新增如下指令,每當有人 commit 時即自動 sync 到 svn2 上
svnsync sync --username syncuser --password xxxxxx svn://svn2/mirror/svn
全站熱搜