【新建svn倉庫】
先創建一個文件夾mkdir /opt/svn/wechat; 然后創建svn版本庫 svnadmin create /opt/svn/wechat;
【創建用戶組權限】
創建好后,創建用戶組權限:打開/opt/svn/wechat/conf/authz文件,加上
[grounps]
team = xman,superman
[/] (代表該組在該目錄下所有文件都具有讀寫權限)
@team = rw
如果需要配置某個文件夾里不同權限:則
[/MaiKing/]
superman = r
【創建用戶名和密碼】
然后創建用戶名和密碼,打開/opt/svn/wechat/conf/passwd文件,加上
xman= xman
superman= superman
【配置文件】
用戶創建完畢,然后再打開/opt/svn/wechat/conf/svnserve.conf
將文件中general下的鍵值對的注釋去掉
包括:
anon-access = read
auth-access = write
password-db = password
authz-db = authz
realm = My First .....
【checkout到項目目錄】
然后checkout到項目根目錄,先打開根目錄
然后checkout版本庫 svn co svn://localhost:9999/wechat
然后輸入服務器密碼,輸入svn賬號,即可成功checkout
checkout完后wechat文件就是我們的項目目錄啦
【創建hook】
然后創建hook,以便本地提交自動更新到項目根目錄
vi /opt/svn/wechat/hooks/post-commit
然后輸入:
#!/bin/sh
export LANG=en_US.UTF-8 #svn 編碼是UTF-8
/usr/local/svn/bin/svn up --username=xman --password=xman --no-auth-cache --non-interactive /alidata/www/wechat
/usr/local/svn/bin/svn up --username=xman --password=xman --no-auth-cache --non-interactive /alidata/www/wechat
然后wq保存。
保存好后再給post-commit這個hook文件設置權限:chmod 744 post-commit
然后就完事了