MAC搭建svn服务器方法

MAC版本10.9.1默认带有svn工具

1、打开终端

输入svn --version

laoyuliangdeiMac:hello laoyuliang$ svn --version
svn, version 1.7.10 (r1485443)
   compiled Aug 13 2013, 15:31:22

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 access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - handles 'http' scheme
  - handles 'https' scheme
出现如上的现象则证明你的mac自带有svn


2、创建一个代码仓库

laoyuliangdeiMac:~ laoyuliang$ svnadmin create /Users/laoyuliang/svn

最后的“/Users/laoyuliang/svn“是需要创建的路径


3、修改代码仓库配置

进入我们创建的代码仓库会出现如下文件

laoyuliangdeiMac:svn laoyuliang$ ls
README.txt	db		hooks
conf		format		locks
其中的conf下存放着配置文件,进入config目录

laoyuliangdeiMac:svn laoyuliang$ cd conf/
laoyuliangdeiMac:conf laoyuliang$ ls
authz		passwd		svnserve.conf
首先修改authz文件,打开此文件做如下修改

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
添加如下内容

[groups]
svn_group=laoyl			#创建svn_group群组,添加laoyl用户
[/]
laoyl=rw			#给予用户读写权限,还可以写成@svn_group=rm给这个群组予以读写权限
*=
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

passwd文件内容:

[users]
# harry = harryssecret
# sally = sallyssecret
增加如下:
[users]
laoyl=123456
# harry = harryssecret
# sally = sallyssecret
svnserve.conf文件内容如下:

将文件中的如下四句:

#anon-access = read
#auth-access = write
#password-db = passwd
#authz-db = authz
去掉他们的注释,需要注意的是该四句话#后含有一个空格,必须去除,首字母定格,否则会报错。


3、启动svn服务器

输入如下指令,启动svnserver

laoyuliangdeiMac:~ laoyuliang$ svnserve -d -r /Users/laoyuliang/svn/
如果没有出现任何提示表明启动成功,如果出现如下提示:

svnserve: E000048: Can't bind server socket: Address already in use

表明已经有svn服务器启动了,那么我们就需要先关闭他,首先需要找到该svn服务器的后台进程id好,输入如下指令:

laoyuliangdeiMac:~ laoyuliang$ ps -e|grep svnserve
27065 ??         0:00.00 /Applications/Xcode.app/Contents/Developer/usr/bin/svnserve -d -r /Users/laoyuliang/svnroot/
27222 ttys000    0:00.00 grep svnserve
出现了已经启动的svn服务器的id号是27065,使用kill指令将其杀死:kill 27065

再次启动svn服务器就可以了。


4、测试导入和检出代码

导入代码:

laoyuliangdeiMac:base laoyuliang$ svn import /Users/laoyuliang/Documents/project/base/helloipad/ svn://localhost/svn/helloipad --username laoyl --password 123456 -m "init import"


检出代码:

laoyuliangdeiMac:project laoyuliang$ svn checkout svn://127.0.0.1/svn/helloipad --username=laoyl --password=123456

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值