F
转自:https://www.cnblogs.com/heinoc/p/3805779.html
一、安装SVN
Linux 下可以直接通过如下命令直接获取svn server:(我使用的服务器系统为Debian 7.5 稳定版)
apt-get install subversion
安装完成后,可通过svnserve --version 查看安装的版本,我所使用的svn server 版本为1.6.17:
二、创建代码库
创建库(以test库为例):
sudo svnadmin create /home/user/svn/test
这样,一个简单的代码仓库就创建完成了。
接下来启动svn服务:
svnserve -d -r /home/user/svn/test
然后client端就可以通过“svn://ip.ip.ip.ip/test”来访问svn了。
三、权限配置
进入test目录之后,你会看到里边有个“conf”文件夹,进入conf文件夹,ls一下,你会看到有三个文件authz、passwd、svnserve.conf三个配置文件:
1、其中authz用来配置用户访问权限的;
2、passwd用来配置用户及密码;
3、svnserve.conf是对整个svnserve的进程进行配置的。
首先,用vi工具打开svnserve.conf,找到“# password-db = passwd”等,这一句是指定当前库所对应的用户配置文件的,我们需要把最前边的“#”和空格删掉;
password-db = /home/svn/agriculture/conf/passwd
authz-db = /home/svn/agriculture/conf/authz
realm = /home/svn/agriculture
anon-access = none
auth-access = write
接下来,设置用户权限和账号密码 ,密码设置如下:
[checkuser@Ali-Test-DB conf]$ cat 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]
# harry = harryssecret
# sally = sallyssecret
test01=test01
developer01=developer01
默认设置四个文件夹:
branchers、truck、tags、document。
角色分为:
项目经理、组长、开发者、测试。
角色的权限分配:
测试:只能读写document
开发:只能读写document、branchers、truck
组长、经理:读写document、branchers、truck、tags
文件夹权限配置
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
manger=manger,teamleader
testers=test01
developers=developer01
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[/]
@manger=rw
*=r #注意如果此注释掉,则表示出管理员角色,对其他都不可见。那么其他觉得必须直接跳转至制定目录方可使用。
[/branches]
@developers=rw
[/truck]
@developers=rw
[/document]
@testers=rw
@developers=rw
启动和关闭svn方式方法:
1、查看svn进程是否存在:
ps aux|grep svn
2、删除svn进程 kill -9 pid
3、启动svn
svnserve -d -r /home/svn/