---
title: "(转)mac 下搭建svn"
author: "frank__wang"
date: "2013-09-25T22:02:43Z"
tags: ["SVN"]
categories: ["移动开发"]
slug: "mac-svn"
draft: false
lastmod: "2013-09-25T22:02:43Z"
id: 1947288
url: "https://frank--wang.iteye.com/blog/1947288"
---

多谢作者提供这篇文章，解决我了一个大问题。

     文章转自：http://www.codeios.com/thread-139997-1-1.html

 

1. svn import /Users/gaohf/projects/demo/ svn://localhost/svn/repository/demo --username gaohf --password 123456 -m "Initial import"

*复制代码*

Mac自带了svn服务端和客户端，所以只需要简单配置一下就可以使用。

1、创建svn repository

1. svnadmin create /Users/gaohf/svn/repository

*复制代码*

2、配置svn用户权限/Users/gaohf/svn/repository/conf/目录下存在3个文件：authz、passwd、svnserve.conf

authz，内容如下：

01. \### This file is an example authorization file for svnserve.
02. \### Its format is identical to that of mod\_authz\_svn authorization
03. \### files.
04. \### As shown below each section defines authorizations for the path and
05. \### (optional) repository specified by the section name.
06. \### The authorizations follow. An authorization line can refer to:
07. ###  - a single user,
08. ###  - a group of users defined in a special \[groups] section,
09. ###  - an alias defined in a special \[aliases] section,
10. ###  - all authenticated users, using the '$authenticated' token,
11. ###  - only anonymous users, using the '$anonymous' token,
12. ###  - anyone, using the '\*' wildcard.
13. \###
14. \### A match can be inverted by prefixing the rule with '~'. Rules can
15. \### grant read ('r') access, read-write ('rw') access, or no access
16. \### ('').
17. \[aliases]
18. \# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
19. \[groups]
20. test\_group = test
21. \# harry\_sally\_and\_joe = harry,sally,&joe
22. \[/]
23. test=rw
24. \# &joe = r
25. \* =
26. \# \[repository:/baz/fuz]
27. \# @harry\_and\_sally = rw
28. \# * = r

*复制代码*

注意： 这里面是授权  
        里面的［/］ 不能掉

passwd，内容如下：

1. \### This file is an example password file for svnserve.
2. \### Its format is similar to that of svnserve.conf. As shown in the
3. \### example below it contains one section labelled \[users].
4. \### The name and password for each user follow, one account per line.
5. \[users]
6. test=123456

*复制代码*

svnserve.conf，内容如下：

01. \### This file controls the configuration of the svnserve daemon, if you
02. \### use it to allow access to this repository.  (If you only allow
03. \### access through http: and/or file: URLs, then this file is
04. \### irrelevant.)
05. \### Visit http://subversion.tigris.org/ for more information.
06. \[general]
07. \### These options control access to the repository for unauthenticated
08. \### and authenticated users.  Valid values are "write", "read",
09. \### and "none".  The sample settings below are the defaults.
10. anon-access = read
11. auth-access = write
12. \### The password-db option controls the location of the password
13. \### database file.  Unless you specify a path starting with a /,
14. \### the file's location is relative to the directory containing
15. \### this configuration file.
16. \### If SASL is enabled (see below), this file will NOT be used.
17. \### Uncomment the line below to use the default password file.
18. password-db = passwd
19. \### The authz-db option controls the location of the authorization
20. \### rules for path-based access control.  Unless you specify a path
21. \### starting with a /, the file's location is relative to the the
22. \### directory containing this file.  If you don't specify an
23. \### authz-db, no path-based access control is done.
24. \### Uncomment the line below to use the default authorization file.
25. authz-db = authz
26. \### This option specifies the authentication realm of the repository.
27. \### If two repositories have the same authentication realm, they should
28. \### have the same password database, and vice versa.  The default realm
29. \### is repository's uuid.
30. \# realm = My First Repository
31. \[sasl]
32. \### This option specifies whether you want to use the Cyrus SASL
33. \### library for authentication. Default is false.
34. \### This section will be ignored if svnserve is not built with Cyrus
35. \### SASL support; to check, run 'svnserve --version' and look for a line
36. \### reading 'Cyrus SASL authentication is available.'
37. \# use-sasl = true
38. \### These options specify the desired strength of the security layer
39. \### that you want SASL to provide. 0 means no encryption, 1 means
40. \### integrity-checking only, values larger than 1 are correlated
41. \### to the effective key length for encryption (e.g. 128 means 128-bit
42. \### encryption). The values below are the defaults.
43. \# min-encryption = 0
44. \# max-encryption = 256

*复制代码*

3、启动服务器

1. svnserve -d -r /Users/gaohf/svn/repository

*复制代码*

没有任何提示就说明启动成功了。

4、将项目导入svn库

1. svn import /Users/gaohf/projects/demo/ svn://localhost/svn/repository/demo --username gaohf --password 123456 -m "Initial import"

*复制代码*

5、签出项目

1. svn checkout svn://127.0.0.1/svn/repository/demo --username=test--password=123456

*复制代码*