天天看点

mac lion svnserver搭建 笔记

good:

http://2015.iteye.com/blog/1212802

Mac自带了svn服务端和客户端,所以我们不用再去下载了。

下面我列出配置步骤:

1: 在你的mac上创建一个目录,作为将来svn服务器的工作空间。

    例如:你创建了一个目录“svnroot”  (很多人想知道目录的完整路径,选中svnroot--》右键--》查看详情 如下图 : ( 注意   "位置: /wf "  字样))

               那么你的本地完整路径就是  /wf/svnroot

mac lion svnserver搭建 笔记

2: 去svnroot中看一下,文件夹中现在应该是空的,在下面创建一个repository目录

3: 运行黑黑的shell终端将2中创建的 repository 指定为svn server的版本库目录

        执行命令:

       svnadmin create /wf/svnroot/repository

mac lion svnserver搭建 笔记

     然后你在repository 中应该能看见新生成了一些文件: 如下图:

mac lion svnserver搭建 笔记

  4: 修改repository/conf目录中的配置文件。 有三个文件  authz、passwd、svnserve.conf

       4.1:    authz  修改后应该像下面这样:

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

### Its format is identical to that of mod_authz_svn authorization

### files.

### As shown below each section defines authorizations for the path and

### (optional) repository specified by the section name.

### The authorizations follow. An authorization line can refer to:

###  - a single user,

###  - a group of users defined in a special [groups] section,

###  - an alias defined in a special [aliases] section,

###  - all authenticated users, using the '$authenticated' token,

###  - only anonymous users, using the '$anonymous' token,

###  - anyone, using the '*' wildcard.

###

### A match can be inverted by prefixing the rule with '~'. Rules can

### grant read ('r') access, read-write ('rw') access, or no access

### ('').

[aliases]

# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]

monsters_group=wanfan

[/]

wangfan=rw

*=

# [/foo/bar]

# harry = rw

# &joe = r

# * =

# [repository:/baz/fuz]

# @harry_and_sally = rw

# * = r

      4.2   passwd  修改后应该如下

### 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]

wangfan=1234567890

4.3 svnserve.conf 修改后应该如下: ### 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

5: 启动svn服务器 输入下面的命令:   svnserve -d -r /wf/svnroot/repository 没有任何提示就说明启动成功了。

6: 在你的mac 上创建一个空的目录作为你的提交目录:(关键是本地可访问) 信息如下图:(wangfanapi 就是源代码目录)

mac lion svnserver搭建 笔记

7: 将6中创建的目录导入到版本管理仓库repository中。

      shell 命令如下:

       svn import /wf/svnroot/temps/ wangfanapi / svn://localhost/svn/ repository/wangfanapi --username wangfan --password 1234567890 -m "init import"

mac lion svnserver搭建 笔记

 如果你能看见上面步骤7中的样子。。 每一行前面的 adding xxx 就表好似正在将本地文件添加到版本管理系统中。

8:检出项目: (在bash窗口下面你到任意一个目录,然后运行下面的命令就能将刚才 7 中导入的项目检出)

      svn checkout svn://localhost/svn/repository/wangfanapi --username=wangfan --password=1234567890

//-------------------------------------------------后记-------------------------------

 problem A  如果遇到提示 *********** 翻译过来就是 数据畸形。。。  和 JAVAHL 有关的一个东东。

            answer: 把整个ecllipse 卸载了,  重新安装了ADT 和 subclipse

                            (注意subclipse 用的是1.6,原因是 subversion1.8 需要搭配 javahl1.7 这个我不知道是否自动更新下来的东西符合条件。

                                                                关于搭配参见:   http://subclipse.tigris.org/wiki/JavaHL

                             ) 

         ADT更新地址:                       https://dl-ssl.google.com/android/eclipse

        subversion 1.6 更新地址:       http://subclipse.tigris.org/update_1.6.x

problem B: 

        Not authorized to open root of edit operation

         http://www.blogjava.net/zhouf/articles/251635.html

        Subversion装了1.5.2版,乌龟SVN装的是1.5.1版本,可以通过乌龟正常访问到版本库,但当check out时却出现了"Not authorized to open root of edit operation"错误,上网搜索了一下,提供的解决版本如下:

anon-access 属性对目录权限的影响

你想将你的代码库开放给所有人访问,于是你就开放了匿名访问权限,在 svnserve.conf 文件中添加一行:"anon-access=read"。可是对于部分目录,你又不希望别人看到,于是针对那些特别目录,你在 authz.conf 里面进行配置,添加了授权访问的人,并添加了"* ="标记。你认为一切OK了,可是你却发现,那个特别目录却无法访问了,总是提示"Not authorized to open root of edit operation"或者"未授权打开根进行编辑操作"。你再三检查你配置的用户名与密码,确认一切正确,还是无法解决问题

原来,Subversion 有个小 bug ,当"anon-access=read"并且某个目录有被设置上"* ="标记,则会出现上述问题。这个 bug 在当前最新版本上(v1.4)还存在

但我并没有设"*="这种访问方式,用户名、密码、目录访问都正确设置了。当把 anon-access=read 改成 anon-access=none 后,发现,真的可以正常访问了