在 Windows 7 上部署 Subversion (SVN) 版本控制伺服器,採用 svnserve 獨立服務模式,搭配 TortoiseSVN 客戶端,支援認證、授權、多版本庫、Windows 服務自動啟動。本文記錄軟體準備、安裝、版本庫建立、設定檔修改、服務註冊全流程。
svnserve.exe)。安裝時自訂路徑 (如 D:\SVN\Server、D:\SVN\Client),方便管理。
D:\svn\repository。svnadmin create D:\svn\repository\myrepositoryconf、db、hooks、locks、format、README.txt。conf/svnserve.conf)[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
realm = My SVN Repository
# 且行首不能有空格。anon-access = none 禁止匿名存取。conf/passwd)[users]
admin = admin123
dev1 = dev123
test = test123
格式:用戶名 = 密碼,明文儲存 (svnserve 特性),生產環境建議改用 Apache + mod_dav_svn + LDAP/SSO。
conf/authz)[groups]
admins = admin
developers = dev1
testers = test
[/]
@admins = rw
* =
[myrepository:/]
@admins = rw
@developers = rw
@testers = r
* =
支援群組、路徑級權限 (r=讀、w=寫)、繼承與排除。
svnserve.exe -d -r D:\svn\repository
-d:守護進程模式 (背景執行)。-r:指定版本庫根目錄,客戶端 URL 為 svn://IP/專案名。sc create SVNService binpath= "D:\SVN\Server\bin\svnserve.exe --service -r D:\svn\repository" displayname= "SVN Server" depend= Tcpip start= autobinpath= 等號後必須有空格,路徑含空格需雙引號包裹。services.msc) 中即可見「SVN Server」,狀態「執行中」,啟動類型「自動」。svn://伺服器IP/myrepository。