SVN

SVN

SVN全称subversion,是一个开源版本控制系统,始于2000年。

SVN依赖于服务端,任何操作需要在服务端来管理。

SVN的安装与使用

1.安装SVN(服务端)
[root@antong ~]# yum install -y subversion
//创建版本库 
[root@antong ~]# mkdir -p /data/svnroot/myproject
[root@antong ~]# svnadmin create /data/svnroot/myproject
[root@antong ~]# cd !$conf 	  //authz为权限配置文件,passwd为密码文件
[root@antong ~]# cd /data/svnroot/myproject/conf
[root@antong ~]# vim authz	 	//配置文件改为如下
[groups]
admins = antong,user1			//admins组包含antong与user1用户
[/]						//指项目目录
@admins = rw				//设置组权限
*= r
[myproject:/]				//针对项目设置权限
user1 = rw
[root@antong ~]# vim passwd		//加入如下内容
[users]
antong=000000
user1=user1000
user2=user2000

[root@antong ~]# vim svnserver.conf		//更改或增加如下内容
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
realm = /data/svnroot/myproject

[root@antong ~]# svnserve -d -r /data/svnroot 		//这样就启动了
[root@antong ~]# cd /opt/
[root@antong ~]# svn checkout svn://192.168.200.10/myproject --username=lsk		//拉取项目
Authentication realm: <svn://192.168.200.10:3690> /data/svnroot/myproject
Password for 'root': 			//输入root的密码
Authentication realm: <svn://192.168.200.10:3690> /data/svnroot/myproject
Username: antong			//输入用户名
Password for 'antong': 		//输入该用户密码,这里为000000

-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <svn://192.168.200.10:3690> /data/svnroot/myproject

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes		//输入yes
Sending        fstab
Transmitting file data .
Checked out revision 0.
//第一次登陆需要输入

[root@antong ~]# cd myproject ; ls -la
total 5
drwxr-xr-x. 3 root root  56 Aug  5 10:34 .
drwxr-xr-x. 6 root root  62 Aug  5 10:22 ..
drwxr-xr-x. 4 root root  70 Aug  5 10:34 .svn
2.客户端使用SVN
[root@antong ~]# yum install -y subversion
[root@antong ~]# cd /opt/
[root@antong ~]# svn checkout svn://192.168.200.10/myproject --username=antong		//拉取项目
...同样输入密码000000
Checked out revision 0.

[root@antong ~]# cd myproject ; ls -la
total 5
drwxr-xr-x. 3 root root  56 Aug  5 19:34 .
drwxr-xr-x. 6 root root  62 Aug  5 19:22 ..
drwxr-xr-x. 4 root root  70 Aug  5 19:34 .svn

[root@antong ~]# cp /etc/fstab .
[root@antong ~]# svn add fstab  //添加到版本控制中心
A         fstab

[root@antong ~]# svn commit -m "add fstab file" 	//把文件上传到服务器
Adding         fstab
Transmitting file data .
Committed revision 1.

[root@antong ~]# svn delete fstab  //在本地删除
D         fstab

[root@antong ~]# svn commit -m "delete fstab file" 	//在服务器上提交删除操作
Deleting       fstab

Committed revision 2.

[root@antong ~]# svn update 		//把当前目录下的文件都更新到最新版
Updating '.':
At revision 2.

[root@antong ~]# svn log		 //查看变更日志
------------------------------------------------------------------------
r2 | antong | 2021-08-27 19:49:10 -0400 (Wed, 05 Aug 2020) | 1 line

delete fstab file
------------------------------------------------------------------------
r1 | antong | 2021-08-27 19:48:18 -0400 (Wed, 05 Aug 2020) | 1 line
add fstab file
posted @ 2021-08-28 22:35  殇黯瞳  阅读(71)  评论(0编辑  收藏  举报