服務端安裝完成后
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
下一節介紹下,權限分配 解決沖突等
參考:http://www.runoob.com/svn/svn-start-mode.html