一、安裝
下載
http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
如:安裝到 D:\deploy\Subversion
二、建立Repository
打開(kāi)命令窗口, 鍵入 :
svnadmin create --fs-type fsfs G:\svnsrc\game
三、配置Repository
進(jìn)入Repository目錄,在本文中是 G:\svnsrc\game
,你會(huì)看到conf目錄,進(jìn)入該目錄,你會(huì)看到svnserve.conf和passwd兩個(gè)文件
對(duì)兩個(gè)文件作如下修改
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 conf directory.
### Uncomment the line below to use the default password file.
password-db = passwd


passwd
[users]
# harry = harryssecret
# sally = sallyssecret
alpha=123456
svnserve.conf中的[general] 和 passwd 中的 [users] 行前有#,一定要去掉,不要有空格
四、啟動(dòng)subversion
打開(kāi)命令窗口鍵入
svnserve -d -r G:\svnsrc
默認(rèn)端口是3690,如果不幸這個(gè)端口被別的程序暫用,可以通過(guò)選項(xiàng) --listen-port=綁定端口
url格式為 svn://ip地址//Repository 名,在本文中是svn://127.0.0.1/game
======
將Subversion安裝成service。讓subversion在windows自動(dòng)啟動(dòng)
以前的svnserve要想成為windows服務(wù),必須依賴于svnservice或其他工具。從Subversion1.4開(kāi)始,Subversion本身就集成Windows服務(wù)的工具。
1,安裝svnservice
在Windows NT中(包括Windows XP, Windows 2000, Windows 2003 Server)本身包含了一個(gè)安裝服務(wù)的工具,叫做"Service Control",也就是sc.exe。
例如我的Subversion安裝在"D:Subversion",版本庫(kù)在"D:svnroot",而我希望對(duì)應(yīng)的Subversion服務(wù)名為svnservice,安裝這個(gè)svn服務(wù)的命令就可以這樣寫:
sc create svnservice
binpath= "D:Subversionbinsvnserve.exe --service -r D:svnroot"
displayname= "SVNService"
depend= Tcpip
請(qǐng)注意,因?yàn)楸阌诓炜矗厦娴拿罘譃槎嘈校趯?shí)際執(zhí)行時(shí)應(yīng)該在一行里。另外,在以前啟動(dòng)svnserve時(shí)會(huì)使用"-d"選項(xiàng),也就是守護(hù)進(jìn)程模式,在這里不能使用,會(huì)導(dǎo)致服務(wù)無(wú)法啟動(dòng)。同樣,"-i"和"-t"選項(xiàng)也不能使用。
在命令行窗口執(zhí)行完這個(gè)命令之后,服務(wù)還沒(méi)有啟動(dòng),你可以繼續(xù)運(yùn)行"net start svnservice"啟動(dòng)這個(gè)服務(wù),然后使用"net stop svnservice"停止服務(wù)。
另外還有兩點(diǎn)需要小心處理。首先,如果路徑中包括空格,一定要用“”處理“"”號(hào),例如上面的例子中如果svnserve.exe在“c:program filessubversion”中,則命令應(yīng)該寫為“binpath= ""c:program filessubversionbinsvnserve.exe"”(“”中的內(nèi)容),整個(gè)命令如下,紅色部分是改變部分:
sc create svnservice
binpath= ""D:program filesSubversionbinsvnserve.exe" --service -r D:svnroot"
displayname= "SVNService"
depend= Tcpip
其次,sc對(duì)選項(xiàng)的格式還有要求,例如“depend= Tcpip”不能寫為“depend = Tcpip”或“depend=Tcpip”,也就是“=”前不能有空各,而后面必須有空格。
2,刪除服務(wù)
如果服務(wù)安裝的有問(wèn)題,你可能需要?jiǎng)h除服務(wù)。要?jiǎng)h除前面添加的服務(wù),只需要運(yùn)行"sc delete svnservice","svnservice"就是我們創(chuàng)建服務(wù)時(shí)使用的名字。
3,配置服務(wù)是自動(dòng)啟動(dòng)
默認(rèn)情況下安裝的服務(wù)不會(huì)隨Windows的啟動(dòng)而啟動(dòng),為了使svn服務(wù)能夠隨Windows啟動(dòng)而啟動(dòng),需要修改一下"sc create"命令(首先要?jiǎng)h除),增加"start= auto"選項(xiàng):
sc create svnservice
binpath= "D:Subversionbinsvnserve.exe --service -r D:svnroot"
displayname= "SVNService"
depend= Tcpip
start= auto
當(dāng)然你也可以使用圖形化的工具修改服務(wù)的屬性,你可以在“開(kāi)始->運(yùn)行...”中執(zhí)行"services.msc",然后在界面中修改。