1、安裝SVN服務器,到http://subversion.apache.org/packages.html上下載windows版的SVN,并安裝,在命令行下運行svn命令,如下所以,則svn服務器安裝成功。
- C:\Documents?and?Settings\Administrator>svn???
- 使用“svn?help”得到用法。??
? ?
2、創建倉庫Repository:運行命令
- C:\Documents?and?Settings\Administrator>svnadmin?create?G:\svn??
?
該命令會在G盤下自動創建一個名字為svn的文件夾,該文件中的內容如非必要,不要手動修改,其內容是由svn自動維護的,各自得用途:?
conf里文件夾中都是這個倉庫的配置文件。?
db是真正用來存儲數據版本的地方。?
hooks文件夾中的內容用以定義某些動作觸發的hook腳本。?
locks中的文件用于在某些分支或者文件上加鎖。 ?
3、創建用戶:進入conf目錄(本例中是G:\svn\conf),打開svnserve.conf文件,找到如下內容:
- [general]???
- ###?These?options?control?access?to?the?repository?for?unauthenticated???
- ###?and?authenticated?users.??Valid?values?are?"write",?"read",???
- ###?and?"none".??The?sample?settings?below?are?the?defaults.???
- #?anon-access?=?read???
- #?auth-access?=?write???
- ###?The?password-db?option?controls?the?location?of?the?password???
- ###?database?file.??Unless?you?specify?a?path?starting?with?a?/,???
- ###?the?file's?location?is?relative?to?the?directory?containing???
- ###?this?configuration?file.???
- ###?If?SASL?is?enabled?(see?below),?this?file?will?NOT?be?used.???
- ###?Uncomment?the?line?below?to?use?the?default?password?file.???
- #?password-db?=?passwd??
?? 將
- #?anon-access?=?read???
- #?auth-access?=?write???
- #?password-db?=?passwd??
? 中的注釋去掉修改為
?
- anon-access?=?read???
- auth-access?=?write ??
- password-db?=?passwd??
?
?這樣就可以使用passwd文件中的用戶了。
打開passwd(和svnserve.conf在同目錄下),可以看到,創建好的兩個用戶都被注釋掉了,可以修改者兩個用戶,也可以新建自己的用戶,這里我新創建了一個自己的用戶,passwd文件被修改為:
- [users]??
- #?harry?=?harryssecret??
- #?sally?=?sallyssecret??
- admin=admin??
4、啟動SVN服務器,運行命令svnserve -d -r G:\svn,就可以啟動服務
- C:\Documents?and?Settings\Administrator>svnserve?-d?-r?G:\svn??
? -d表示后臺運行,-r表示以超級管理員的方式運行,G:\svn是指SVN所管理的倉庫。
5、配置SVN服務器開機啟動
打開一個DOS窗口,在任意目錄下執行下面的命令:
- //在命令中的每一個等號后面都要有一個空格否則命令執行失敗
- sc create svnserve binPath= "\"D:\Apache-Subversion-1.8.9\bin\svnserve.exe\" --service --root d:\projects" displayname= "SVN Serve" depend= Tcpip start= auto
? ??
其中,sc是windows自帶的服務配置程序,參數binPath表示svnserve可執行文件的安裝路徑,由于路徑中的"Program Files"帶有空格,因此整個路徑需要用雙引號引起來。而雙引號本身是個特殊字符,需要進行轉移,因此在路徑前后的兩個雙引號都需要寫成\"
--service參數表示以windows服務的形式運行,--root指明svn repository的位置,service參數與root參數都作為binPath的一部分,因此與svnserve.exe的路徑一起被包含在一對雙引號當中,而這對雙引號不需要進行轉義。
displayname表示在windows服務列表中顯示的名字, depend =Tcpip 表示svnserve服務的運行需要tcpip服務,start=auto表示開機后自動運行。
安裝服務后,svnserve要等下次開機時才會自動運行。
若要卸載svn服務,則執行?sc delete svnserve?即可
這樣SVN的配置就完成了,到http://tortoisesvn.net/downloads.html下載一個SVN客戶端,就可以使用了。
------------------------------------------------------------------------------------------------------------------
來源于:http://www.cnblogs.com/jinmingjie/archive/2012/06/05/2536995.html