天天看點

Subversion和TortoiseSVN建構SVN版本控制

1.下載下傳Subversion的window安裝版本svn-1.4.6-setup.exe

http://subversion.tigris.org/

http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100

2.下載下傳TortoiseSVN的TortoiseSVN-1.5.2.13595-win32-svn-1.5.1.msi版本

http://tortoisesvn.net/

http://tortoisesvn.net/downloads

3.安裝subversion

輕按兩下svn-1.4.6-setup.exe,一路next完成安裝。

設定環境變量,将subversion對bin設定到path中。如:D:Program FilesSubversionbin

4.安裝TortoiseSVN

輕按兩下TortoiseSVN-1.5.2.13595-win32-svn-1.5.1.msi,一路next完成安裝。

SVN的安裝和配置 (工具)

1. Windows 2003 sp1

2. svn-1.3.0-setup.exe SVN服務端軟體

3. SVNService.exe 添加到Windows服務需要的工具

4. TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi SVN用戶端軟體

5. LanguagePack-1.4.0.7501-win32-zh_CN.exe SVN用戶端軟體的中文語言包

相關下載下傳:

1.Subversion

http://subversion.tigris.org

2.用戶端軟體TortoiseSVN

http://tortoisesvn.tigris.org

Eclipse 下使用的插件,需要線上更新

更新位址: http://subclipse.tigris.org/update_1.0.x

安裝指南: http://subclipse.tigris.org/install.html

安裝SVN伺服器

1. 安裝伺服器軟體

2. 将SVN添加到Windows服務

1. 建立一個檔案夾用來存放庫檔案 c:/SVN

2. 運作指令:SVNService -install -d -r c:/svn 安裝 Windows 服務

3. 通過Windows服務管理平台啟動SVN服務

4. 其它指令

1. 改變服務設定:

運作指令:SVNService -setup -d -r <newsvnroot>

在實際操作中,<newsvnroot>代表與SubVersion服務啟動時不同的電子倉庫目錄.

2. 删除服務:

運作指令:SVNService -remove  

5.建立svn容器Repository

在硬碟上任意位置建立一檔案夾,如D:svnRepository,在檔案夾上右鍵

TortoiseSVN->Create repository here

建立成功後将在D:svnRepository下生成一系列檔案。

6.配置容器的通路權限

在容器的目錄下D:svnRepository的conf中,用記事本打開svnserve.conf檔案,找到

# anon-access = read

# auth-access = write

# password-db = passwd

并去掉注釋#

注意,去掉注釋後,不要留下空格,保持每行頂格,切記!!!

效果如下:

### This file controls the configuration of the svnserve daemon, if you

### use it to allow access to this repository. (If you only allow

### access through http: and/or file: URLs, then this file is

### irrelevant.)

### Visit http://subversion.tigris.org/ for more information.

[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

### The authz-db option controls the location of the authorization

### rules for path-based access control. Unless you specify a path

### starting with a /, the file's location is relative to the the

### directory containing this file. If you don't specify an

### authz-db, no path-based access control is done.

### Uncomment the line below to use the default authorization file.

# authz-db = authz

### This option specifies the authentication realm of the repository.

### If two repositories have the same authentication realm, they should

### have the same password database, and vice versa. The default realm

### is repository's uuid.

# realm = My First Repository

[sasl]

### This option specifies whether you want to use the Cyrus SASL

### library for authentication. Default is false.

### This section will be ignored if svnserve is not built with Cyrus

### SASL support; to check, run 'svnserve --version' and look for a line

### reading 'Cyrus SASL authentication is available.'

# use-sasl = true

### These options specify the desired strength of the security layer

### that you want SASL to provide. 0 means no encryption, 1 means

### integrity-checking only, values larger than 1 are correlated

### to the effective key length for encryption (e.g. 128 means 128-bit

### encryption). The values below are the defaults.

# min-encryption = 0

# max-encryption = 256

配置通路使用者清單,使用者名加密碼

記事本打開該目錄下的檔案passwd

去掉

# harry = harryssecret

# sally = sallyssecret

的注釋#,同意注意每行要頂格,開頭也不能有空格。

說明harry = harryssecret表示:使用者名=密碼

當然也可以自己增加,如gary=gary

最好效果如下:

### This file is an example password file for svnserve.

### Its format is similar to that of svnserve.conf. As shown in the

### example below it contains one section labelled [users].

### The name and password for each user follow, one account per line.

[users]

harry=harryssecret

sally=sallyssecret

gary=gary 

7.啟動Subversion

因為之前設定了環境變量path= D:Program FilesSubversionbin;是以打開cmd,直接運作指令:svnserve -d -r D:svnRepository

這樣Subversion伺服器就假設好了。

8.向容器添加需版本控制的檔案(也可以遠端,隻需url為ip就行)

在硬碟上任意位置,右鍵需要上傳的檔案的上級檔案夾,TortoiseSVN->Import…

此處為了測試,建立檔案夾D:importFiles,裡面放一doc檔案test.doc,即要将test.doc上傳到svn中去。右鍵importFiles,TortoiseSVN->Import…,輸入容器的url:

svn://localhost/svnRepository

輸入使用者名和密碼:

就将test.doc檔案上傳到svn容器了

9.從容器獲得test.doc檔案(也可以遠端,隻需url為ip就行)

在任意位置,某檔案上右鍵D:checkOutFiles,點選SVN Checkout…

輸入url即可

10.完成

這樣就完成的部署和存取,修改相應的檔案,送出即可,注意始終保持Subversion的運作。

注意,在第8步中會報錯“期望檔案系統格式“2”;發現格式“3””

原因是TortoisSVN的版本過高,或與Subversion不比對。

應該換成低版本的TortoisSVN 用TortoiseSVN-1.4.8.12137-win32-svn-1.4.6.msi

即應該為svn-1.4.6-setup.exe和TortoiseSVN-1.4.8.12137-win32-svn-1.4.6.msi的組合才行,

步驟和之前的一樣,隻是在第6步中的svnserve.conf檔案中沒有後面的内容

[sasl]

### This option specifies whether you want to use the Cyrus SASL

### library for authentication. Default is false.

### This section will be ignored if svnserve is not built with Cyrus

### SASL support; to check, run 'svnserve --version' and look for a line

### reading 'Cyrus SASL authentication is available.'

# use-sasl = true

### These options specify the desired strength of the security layer

### that you want SASL to provide. 0 means no encryption, 1 means

### integrity-checking only, values larger than 1 are correlated

### to the effective key length for encryption (e.g. 128 means 128-bit

### encryption). The values below are the defaults.

# min-encryption = 0

# max-encryption = 256