subversion(简称svn)是近几年崛起的版本管理软件,是cvs的接班人,目前绝大多数开源软件都使用svn作为代码版本管理软件。Subversion支持linux和windows,但较多安装在linux下。
svn的基本工作原理: 在一台服务器上建立一个源代码库,库里可以存放许多不同项目的源程序。有源代码库管理员统一管理这些源程序。每个用户在使用源代码库之前,首先要把源代码库里德项目文件下载到本地,然后开发人员可以在本地修改,左后用svn命令进行提交,游源代码库统一管理修改。
1、通过本地yum安装svn服务,使用的安装包subversion
点击( 此处 )折叠或打开
2、创建版本库
点击( 此处 )折叠或打开
3、配置svnserve , 在上述目录
/myrepos/conf 生成3个主要的配置文件
点击( 此处 )折叠或打开
3.1 修改svnserve.conf
3.2 修改passwd,设置登录的账号和密码 # 为示例
点击( 此处 )折叠或打开
3.3 修改authz权限
文件 ,设置所有权限
都为可读可写
svn 目录格式:
[/]
@用户组名称 = 权限 (rw)
用户名称 = 权限 (rw)
* =
4、 启动svnserve 服务
5、测试服务
6、 客户端测试svn
6.1 文件导入
6.2 文件取出
6.3 代码添加
点击( 此处 )折叠或打开
参考博客:
http://www.ha97.com/4467.html
svn的基本工作原理: 在一台服务器上建立一个源代码库,库里可以存放许多不同项目的源程序。有源代码库管理员统一管理这些源程序。每个用户在使用源代码库之前,首先要把源代码库里德项目文件下载到本地,然后开发人员可以在本地修改,左后用svn命令进行提交,游源代码库统一管理修改。
1、通过本地yum安装svn服务,使用的安装包subversion
点击( 此处 )折叠或打开
- yum install -y subversion httpd mod_dav_svn
点击( 此处 )折叠或打开
- svnadmin create /myrepos
点击( 此处 )折叠或打开
- [root@mhxy162 conf]# ll
- total 12
- -rw-r--r-- 1 root root 1080 Jul 13 05:46 authz
- -rw-r--r-- 1 root root 309 Jul 13 05:46 passwd
- -rw-r--r-- 1 root root 2279 Jul 13 05:46 svnserve.conf
点击(此处)折叠或打开
- anon-access = read #匿名用户可以读
- auth-access = write #认证用户可以写
- password-db = passwd #密码库文件,默认使用的是同一目录下的passwd文件作为用户密码库
- authz-db = authz #认证权限文件
- realm = My First Repository for Bob Le #登录提示信息
点击( 此处 )折叠或打开
- [users]
- # harry = harryssecret
- # sally = sallyssecret
- libo = 123456
- fanfan =123456
点击(此处)折叠或打开
- [groups] #默认存在
- check = libo,fanfan #定义组,多个user用逗号分开;user必须是passwd文件中存在的
- [/] #表示当前版本库 及/myrepos
- @check = rw # @check 表示这个组的权限
- * = #除了上面定义的权限的用户外,其他的成员都没有权限
svn 目录格式:
[/]
@用户组名称 = 权限 (rw)
用户名称 = 权限 (rw)
* =
点击(此处)折叠或打开
- svnserve -d -r /myrepos/
点击(此处)折叠或打开
- [root@mhxy162 ~]# svn import /root/localsvn/ file:///myrepos/ -m "first edit"
- Adding /root/localsvn/1.html
- Adding /root/localsvn/2.html
- Committed revision 1.
- [root@mhxy162 ~]#
6.1 文件导入
点击(此处)折叠或打开
- [root@localhost ~]# mkdir editwebsite
- [root@localhost ~]# cd editwebsite/
- [root@localhost editwebsite]# ll
- total 0
- [root@localhost editwebsite]# touch 3.html 4.html ; cd
- [root@localhost ~]# svn import /root/editwebsite/ svn://192.168.137.162/myrepos -m "from 163 edit"
- Authentication realm: <svn://192.168.137.162:3690> My First Repository for Bob Le
- Password for 'root':
- Authentication realm: <svn://192.168.137.162:3690> My First Repository for Bob Le
- Username: libo
- Password for 'libo':
- -----------------------------------------------------------------------
- ATTENTION! Your password for authentication realm:
- <svn://192.168.137.162:3690> My First Repository for Bob Le
- 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)? no
- Adding editwebsite/3.html
- Adding editwebsite/4.html
- Committed revision 2.
- [root@localhost ~]#
点击(此处)折叠或打开
- [root@localhost ~]# svn checkout svn://192.168.137.162/myrepos/ downsource
- Authentication realm: <svn://192.168.137.162:3690> My First Repository for Bob Le
- Password for 'libo':
- -----------------------------------------------------------------------
- ATTENTION! Your password for authentication realm:
- <svn://192.168.137.162:3690> My First Repository for Bob Le
- 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)? no
- A downsource/3.html
- A downsource/4.html
- Checked out revision 2.
-
- [root@localhost ~]# ll downsource/
- total 0
- -rw-r--r-- 1 root root 0 Jul 12 22:51 3.html
- -rw-r--r-- 1 root root 0 Jul 12 22:51 4.html
- [root@localhost ~]#
点击( 此处 )折叠或打开
- [root@localhost ~]# cd downsource/
- [root@localhost downsource]# ll
- total 0
- -rw-r--r-- 1 root root 0 Jul 12 22:51 3.html
- -rw-r--r-- 1 root root 0 Jul 12 22:51 4.html
- [root@localhost downsource]# touch libo.html
- [root@localhost downsource]# svn add libo.html
- A libo.html
- [root@localhost downsource]# svn commit -m "third edit"
- Authentication realm: <svn://192.168.137.162:3690> My First Repository for Bob Le
- Password for 'libo':
- -----------------------------------------------------------------------
- ATTENTION! Your password for authentication realm:
- <svn://192.168.137.162:3690> My First Repository for Bob Le
- 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)? no
- Adding libo.html
- Transmitting file data .
- Committed revision 3.
- [root@localhost downsource]#
参考博客:
http://www.ha97.com/4467.html
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27039319/viewspace-2121928/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/27039319/viewspace-2121928/