跳轉到內容

Subversion/在 Windows 下設定伺服器

來自華夏公益教科書

更新至 1.4.4

最佳文件可在 TortoiseSVN 幫助檔案中找到。請安裝 TortoiseSVN,手冊可以引導任何人在 Windows 下安裝。

本文基於一篇有用的部落格文章Setting_up_a_Subversion_Server_under_Windows,該文章已過時。

您不再需要下載“svnservice”包裝器或類似程式,因為從版本 ?? 開始,Subversion 伺服器可以作為服務執行。有關詳細資訊,請參見[1]

安裝伺服器

[編輯 | 編輯原始碼]

1) 解壓縮 Windows 二進位制檔案,例如到 c:\Program Files\subversion\

2) 將 subversion 二進位制檔案的路徑新增到系統 Path 環境變數:%programfiles%\subversion\bin\

3) 建立 SVN_EDITOR 環境變數以指定要使用的文字編輯器

啟動伺服器服務

[編輯 | 編輯原始碼]
sc create SVNserve binpath= "c:\Program Files\subversion\bin\svnserve.exe --service --root \"c:\svn_root\"" displayname= "Subversion Repository" depend= Tcpip start= auto

啟動服務

net start SVNserve

安裝客戶端

[編輯 | 編輯原始碼]

執行安裝程式。最後,它會要求重新啟動,但這不是必需的。

建立倉庫

[編輯 | 編輯原始碼]

您可以透過命令列或透過 TortoiseSVN 建立倉庫。可以以多種方式訪問倉庫。轉到命令提示符並鍵入:“svn --version”以檢視可用方法的列表。

預設值為

  • ra_dav : 用於透過 WebDAV (DeltaV) 協議訪問倉庫的模組。
 - handles 'http' scheme
 - handles 'https' scheme
  • ra_svn : 用於使用 svn 網路協議訪問倉庫的模組。
 - handles 'svn' scheme
  • ra_local : 用於訪問本地磁碟上的倉庫的模組。
 - handles 'file' scheme

1a) 在命令提示符中,執行

svnadmin create "c:\svn_root"

1b) 在資源管理器中右鍵單擊,TortoiseSVN | 在此處建立倉庫... 顯然,您應該在 c:\ 下建立一個名為“svn_root”的資料夾。

2) 轉到您在上面建立的目錄,開啟 ./conf/svnserve.conf 並取消註釋以下行(從行首刪除 #)

[general]
anon-access = read
auth-access = write
password-db = passwd

3) 取消註釋 ./conf/passwd 中的以下行

[users]
harry = harryssecret
sally = sallyssecret

5a) 建立供 svn 訪問的專案

svn mkdir svn:///myproject
// the svnserve is listening for connections on svn:// and it points to "C:\svn_root\" in this example
// as the sc command written above has that path set
// the repository will have "myproject" as the first folder under the root

5b) 建立供本地檔案訪問的專案(使用 TortoiseSVN)

Go to Repo-broser[check spelling] and look at: file:///c:\svn_root/
right click and add a folder

建立專案

[編輯 | 編輯原始碼]

1) 為您的工作副本建立一個目錄。右鍵單擊它並選擇“SVN 檢出...”

2a) 鍵入 svn:///myproject/ 2b) 鍵入 file:///c:\svn_root/

華夏公益教科書