服务端安装完成后

1.创建一个存放仓库的文件夹(这里在home目录创建)



#mkdir svnRepo



#cd svnRepo/


创建一个仓库 (写全路径)



# svnadmin create /root/svnRepo/test.com


 

 查看仓库里面默认的文件结构



[root@wentao13 svnRepo]# cd test.com/
[root@wentao13 test.com]# ll
total 8
drwxr-xr-x. 2 root root 54 Mar 29 08:59 conf //配目录件 匿名读写,授权都要在这里修改
drwxr-sr-x. 6 root root 233 Mar 29 08:59 db //程序存放
-r--r--r--. 1 root root 2 Mar 29 08:59 format
drwxr-xr-x. 2 root root 231 Mar 29 08:59 hooks //钩子 实现一些高级功能
drwxr-xr-x. 2 root root 41 Mar 29 08:59 locks
-rw-r--r--. 1 root root 229 Mar 29 08:59 README.txt
[root@wentao13 test.com]#


 

 启动仓库(这里对整个大仓库的启动,也可以对项目仓库启动,也就是单库和多库的区别访问方式也不同): 



[root@wentao13 svnRepo]# svnserve -d -r /root/svnRepo/


 

查看是否启动:端口是3690



[root@wentao13 svnRepo]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 12667/svnserve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1118/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1913/master
tcp6 0 0 :::3306 :::* LISTEN 1603/mysqld
tcp6 0 0 :::22 :::* LISTEN 1118/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1913/master


 

 访问(取得联系,及git clone):



[root@wentao13 111]# svn checkout svn://localhost/test.com
Checked out revision 0.


上面命令完成,本地已经把仓库文件拉下来了,并创建了test.com



drwxr-xr-x. 3 root root  18 Mar 29 09:13 test.com
[root@wentao13 111]# cd test.com/
[root@wentao13 test.com]# ll -a
total 0
drwxr-xr-x. 3 root root 18 Mar 29 09:13 .
drwxr-xr-x. 3 root root 22 Mar 29 09:13 ..
drwxr-xr-x. 4 root root 75 Mar 29 09:13 .svn


 

 接下来,修改本地文件,提交:

1.加入提交队列



[root@wentao13 test.com]# svn add 1.php 
A 1.php


2.提交svn库里面



[root@wentao13 test.com]# svn commit -m "commit 1.php file" 1.php 
svn: E170001: Commit failed (details follow):
svn: E170001: Authorization failed //权限验证失败


 

 一般这样是可以提交成功的,之所以报错,是因为svn服务器禁止匿名用户提交文件.修改svn服务器配置文件即可 (修改下面scnserve.conf文件)



[root@wentao13 conf]# pwd
/root/svnRepo/test.com/conf
[root@wentao13 conf]# ll
total 12
-rw-r--r--. 1 root root 1080 Mar 29 08:59 authz
-rw-r--r--. 1 root root 309 Mar 29 08:59 passwd
-rw-r--r--. 1 root root 3090 Mar 29 08:59 svnserve.conf
[root@wentao13 conf]#


 

配置一个最简单的 (所有匿名用户都可以提交,之后再修改让authz等)

vim svnserve.conf



# anon-access = read
anon-access = write //添加一个 匿名用户都可以提交
# auth-access = write


 

 2.现在提交就没有报错 :



[root@wentao13 test.com]# svn commit -m "commit 1.php file" 1.php 
Adding 1.php
Transmitting file data .
Committed revision 1.


 

 

现在你库里面就有那个文件了 在:

 



[root@wentao13 0]# pwd
/root/svnRepo/test.com/db/revprops/0
[root@wentao13 0]# ll
total 8
-r--r--r--. 1 root root 50 Mar 29 08:59 0
-r--r--r--. 1 root root 85 Mar 29 09:27 1


 

 

总结提示提交就两步:(之后会有图形界面)



[root@wentao13 test.com]# svn add 1.php 
[root@wentao13 test.com]# svn commit -m "commit 1.php file" 1.php


 

 

 下一节介绍下,权限分配  解决冲突等