windows下架設SVN伺服器並設定開機啟動

2021-08-19 21:45:56 字數 2680 閱讀 9053

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= "\"c:\program files\subversion\bin\svnserve.exe\" --service --root d:\svnstore" displayname= "svn serve" depend= tcpip start= auto  

其中,sc是windows自帶的服務配置程式,引數binpath表示svnserve可執行檔案的安裝路徑,由於路徑中的"program files"帶有空格,因此整個路徑需要用雙引號引起來。而雙引號本身是個特殊字元,需要進行轉移,因此在路徑前後的兩個雙引號都需要寫成\"

(sc create mysvnserver binpath= "d:\svn\bin\svnserve.exe --service -r f:\mysvn" displayname= "svnservice" depend= tcpip start= auto )

--service引數表示以windows服務的形式執行,--root指明svn repository的位置,service引數與root引數都作為binpath的一部分,因此與svnserve.exe的路徑一起被包含在一對雙引號當中,而這對雙引號不需要進行轉義。

displayname表示在windows服務列表中顯示的名字, depend =tcpip 表示svnserve服務的執行需要tcpip服務,start=auto表示開機後自動執行。

安裝服務後,svnserve要等下次開機時才會自動執行。

若要解除安裝svn服務,則執行 sc delete svnserve 即可

windows 架設SVN伺服器

想完整走一遍svn布置及使用流程,試完整理了一下 ctrl r,輸入cmd進終端,在命令列下執行svn命令,如下,則安裝成功 step 2 建立倉庫 建立乙個倉庫空資料夾e repos,並在repos資料夾上右鍵選中tortoisesvn create repository here step 3 ...

windows下架設SVN伺服器並設定開機啟動

c documents and settings administrator svn 使用 svn help 得到用法。2 建立倉庫repository 執行命令 c documents and settings administrator svnadmin create g svn 該命令會在g盤...

Ubuntu 架設SVN伺服器

1.svn安裝 sudo apt get install subversion 2.建立倉庫 對於多個 倉庫 首先在 var 下建立svn主目錄。svnadmin create var svn test1 svnadmin create var svn test2 3.修改配置檔案 倉庫目錄下 co...