Mac下安装SVN服务器

安装svnserver

Mac自带svnserver, 输入svnserve –version

1
2
3
4
5
6
7
8
9
10
11
svnserve, version 1.7.10 (r1485443)
compiled Jan 15 2014, 11:22:16

Copyright (C) 2013 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository back-end (FS) modules are available:

* fs_fs : Module for working with a plain file (FSFS) repository.

创建仓库

  1. 创建目录

    • sudo mkdir -p /data/svn/repositories/local
  2. 创建仓库

    • sudo svnadmin create /data/svn/repositories/local

查看: ls -al /data/svn/repositories/local

1
2
3
4
5
6
7
8
9
total 16
drwxr-xr-x 8 root wheel 272 10 23 17:38 .
drwxr-xr-x 3 root wheel 102 10 23 17:18 ..
-rw-r--r-- 1 root wheel 229 10 23 17:38 README.txt
drwxr-xr-x 5 root wheel 170 10 23 17:38 conf
drwxr-sr-x 15 root wheel 510 10 23 17:38 db
-r--r--r-- 1 root wheel 2 10 23 17:38 format
drwxr-xr-x 11 root wheel 374 10 23 17:38 hooks
drwxr-xr-x 4 root wheel 136 10 23 17:38 locks

配置

切换目录

cd /data/svn/repositories/local/conf

编辑svnserve.conf文件

1
2
3
4
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz

编辑passwd文件

1
2
# 在[users] 下添加用户及密码
arccode = arccode

编辑authz文件, 为用户分组, 并对组添加相应的权限

1
2
3
4
5
admin = arccode
[/]
@admin = rw
[local:/]
@admin = rw

启动

sudo svnserve -d -r /data/svn/repositories --log-file=/var/log/svn.log

1
2
# 连接, svnserve默认端口3690
telnet localhost 3690

导入项目

  1. 命令行
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
sudo svn import -m 'init repo' SvnTest/ svn://localhost/local
Password:
Sorry, try again.
Password:
Sorry, try again.
Password:
Authentication realm: <svn://localhost:3690> f70f2b4f-24f7-450c-9c79-99d29ed1e070
Password for 'root':
Authentication realm: <svn://localhost:3690> f70f2b4f-24f7-450c-9c79-99d29ed1e070
Username: arccode
Password for 'arccode':
Adding SvnTest/.classpath
Adding SvnTest/WebRoot
Adding SvnTest/WebRoot/META-INF
Adding SvnTest/WebRoot/META-INF/MANIFEST.MF
Adding SvnTest/WebRoot/index.jsp
Adding SvnTest/WebRoot/WEB-INF
Adding SvnTest/WebRoot/WEB-INF/lib
Adding SvnTest/WebRoot/WEB-INF/web.xml
Adding SvnTest/WebRoot/WEB-INF/classes
Adding SvnTest/.mymetadata
Adding SvnTest/.project
Adding SvnTest/src
Adding SvnTest/.myeclipse
Adding SvnTest/.settings
Adding SvnTest/.settings/org.eclipse.jdt.core.prefs
Adding SvnTest/.settings/org.eclipse.wst.jsdt.ui.superType.name
Adding SvnTest/.settings/org.eclipse.wst.jsdt.ui.superType.container
Adding SvnTest/.settings/org.eclipse.wst.common.project.facet.core.xml
Adding SvnTest/.settings/.jsdtscope
Adding SvnTest/.settings/org.eclipse.wst.common.component

Committed revision 4.
  1. MyEclipse shareProject

配置url为 svn://localhost/local

开机启动

1
2
# 编辑/etc/rc.local(Mac默认无此文件,需要手动创建), 添加
svnserve -d -r /data/svn/repositories --log-file=/var/log/svn.log

参考资料

Mac OS X上搭建本地SVN服务器

转载

本文出自<<arccode>>, 欢迎转载, 转载请注明出处.