1、执行下列指令安装
sudo apt-get install subversion
sudo mkdir /home/svn
sudo mkdir /home/svn/repository
svnadmin create /home/svn/
repository
# anon-access = read ,#auth-access = write ,# password-db = passwd,#authz-db = authz 修改为:
anon-access = none ,auth-access= write,password-db = ../../passwd,authz-db = ../../authz
(password-db = ../../passwd,authz-db = ../../authz代表相对路径而非绝对路径)
4. 下面添加角色
打开svn目录下的passwd文件,创建方法是在[user]下面添加 username = passwd,记得“=”前后的空格,如下图:
(svnadmin控制所有项目,统一管理)
[users]
luolinfeng = 123456
5. 为角色分配权限:
具体权限:(根目录下,svnadmin拥有所有权限,其他人只有读权限,要设置子目录权限,需设置子目录上级的权限方可,设置个别文件权限如下:)
[svnroot:/]
@admin_group = rw
* = r
[repository:/]
@admin_group = rw
* = r
6. 启动svn服务
sudo svnserve -d -r /home/svn
sudo netstat -antp |grep svnserve
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 28967/svnserve
cd /etc/init.d
touch svnd.sh
chmod +x svnd.sh
vi svnd.sh
#!/bin/bash
#svnserve startup
svnserve -d -r /ysh/svn
update-rc.d svnd.sh defaults
svn co svn://172.16.26.28/repository --username xxx --password
8、常用命令:
svn update
svn add "sss" test.py testw.py
svn add "dir" dir_path
svn commit -m "提交增加" test.py testw.py
svn commit -m "提交增加" dir_path
svn delete "sss" test.py testw.py
svn delete "dir" dir_path
svn commit -m "提交删除" test.py testw.py
svn commit -m "提交删除" dir_path
svn co svn://192.168.0.172/repository --username xxx --password xxx
svn co svn://192.168.39.177/repository --username xxx --password xxx
svn st 查看文件夹中文件状态
svn diff acs_detect.py