debian 下配置SVN

SVN有以下几种访问协议:

协议访问方法
file:///通过本地磁盘访问。
http://与Apache组合,通过WebDAV协议访问。
https://同上,但支持SSL协议加密连接。
svn://通过svnserve服务自定义的协议访问。
svn+ssh://同上,但通过SSH协议加密连接。

 

这里只说明SVN://协议的配置及使用

最简单也最实用

当然也将HTTP://协议的也顺便说一点

 

安装apache subversion 

 创建目录:
 # mkdir -p /var/local/repos
 创建仓库数据库:
# svnadmin create /var/local/repos
 将仓库的写权限赋给 kevin:
# chown -R www-data:www-data /var/local/repos

在repos目录下生成了一些文件

├─repos
│  ├─conf
│  ├─dav
│  ├─db
│  │  ├─revprops
│  │  ├─revs
│  │  └─transactions
│  ├─hooks
│  └─locks

进入conf后,修改svnserve.conf文件,设定访问权限,指定authz和passwd文件

svnserve.conf:

[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 = none

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

passwd文件:每一位用户设置,文件内容如下:

[users]
p1_admin1 = p1_admin1
p1_d1 = p1_d1
p1_t1 = p1_t1
         
p2_admin1 = p2_admin1
p2_d1 = p2_d1
p2_t1 = p2_t1

authz文件:

[groups]
# 定义组信息

p1_group_a = p1_admin1
p1_group_d = p1_d1
p1_group_t = p1_t1

p2_group_a = p2_admin1
p2_group_d = p2_d1
p2_group_t = p2_t1


[/]
# 指定所有的版本库默认只读,root可读写
* = r
root = rw


[project1:/]
# 指定对版本库project1根目录的权限
@p1_group_a = rw

导入版本库:

 大家如果想拷贝自己的目录到版本库的话 用下面的命令:
    svn import yourprojectname file:///var/local/repos -m "initial import"
  将工作目录放到新目录
    svn checkout http://192.168.102.20/repos/login/src/   src2

启动 svnserve:svnserve -d -r /var/local/repos 

自动更新:

SVN客户端即可用svn://hostname/来访问,更新操作

这样就完成配置,但还有不足,无法自动更新到WEB目录,现在让我们来完成自动更新设置

 

拷贝版本库中hooks下的post-commit.tmpl为post-commit,并修改post-commit中的内容:

 

将内容
REPOS="$1"
REV="$2"
commit-email.pl "$REPOS" "$REV" commit-watchers@example.org
log-commit.py --repository "$REPOS" --revision "$REV"

 

修改为:/usr/bin/svn update WEB目录 即可。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值