Centos 7svn
SVN 1.7測試
Shell> yum install subversion -y
Shell> mkdir -p /mydata/repository /etc/svnserve
Shell> cd /mydata/repository
Shell> svnadmin create project1 #建立一個項目庫
Shell> cp project1/conf/* /etc/svnserve/ #利用自動生成的模板做爲svn服務端的配置基礎
修改整體配置文件 /etc/svnserve/svnserve.confspa
[general] anon-access = none #禁止匿名訪問 auth-access = write #登陸用戶能夠有寫權限 password-db = passwd #用戶名密碼的配置文件 authz-db = authz #用戶權限的配置文件 realm = My Repository #倉庫的說明文本
修改用戶的配置文件 /etc/svnserve/passwd命令行
[users] user1 = 111 user2 = 222
修改權限的配置文件 /etc/svnserve/authzcode
[groups] admin = user1,user2 #用戶組,建議全部用戶都配置到組以方便權限管理 [/] #根目錄下全部用戶都沒有權限 * = [/project1] #project1項目,admin組的用戶有讀寫權限,其餘用戶只讀權限 @admin = rw * = r
查看下服務的信息blog
Shell> systemctl status svnserve ● svnserve.service - Subversion protocol daemon Loaded: loaded (/usr/lib/systemd/system/svnserve.service; disabled; vendor preset: disabled) Active: inactive (dead)
下面是服務配置文件/usr/lib/systemd/system/svnserve.service的內容,無特殊要求默認便可,不須要修改ip
[Unit] Description=Subversion protocol daemon After=syslog.target network.target [Service] Type=forking EnvironmentFile=/etc/sysconfig/svnserve ExecStart=/usr/bin/svnserve --daemon --pid-file=/run/svnserve/svnserve.pid $OPTIONS [Install] WantedBy=multi-user.target
須要修改的是命令行參數配置文件 /etc/sysconfig/svnserveci
OPTIONS="-r /mydata/repository --config-file /etc/svnserve/svnserve.conf"
默認端口是3690,若須要修改能夠在OPTIONS中加上 --listen-port [port]get
Shell> systemctl start svnserve
Shell> systemctl enable svnserve
第一次輸入用戶名密碼後會提示保存,之後就不須要再輸入了it
若不想保存更不想總提示保存,那就每一個svn命令都加上這三個參數:--username user1 --password 111 --no-auth-cache
Shell> svn co svn://127.0.0.1/project1 ./project1
Shell> cd project1/
Shell> touch 1.txt
Shell> svn add 1.txt
Shell> svn ci . -m 'add 1.txt'
Shell> echo 111 >> 1.txt
Shell> svn ci . -m '修改 1.txt'
Shell> svn log 1.txt
------------------------------------------------------------------------
r2 | user1 | 2019-03-18 17:26:22 +0800 (一, 2019-03-18) | 1 行
修改 1.txt
------------------------------------------------------------------------
r1 | user1 | 2019-03-18 17:25:19 +0800 (一, 2019-03-18) | 1 行
add 1.txt
------------------------------------------------------------------------
over