windows7配置svn服务器

文章转自:http://sjsky.iteye.com/blog/850804 因为这个文章有些老了,稍微做了点改动


一、首先需要获取服务端和客户端 

1、下载服务器端安装包,最新版本1.8:

官网:http://subversion.tigris.org/ or http://subversion.apache.org/ 
下载地址:win32svn http://sourceforge.net/projects/win32svn/ 

2、下载客户端安装包,最新版本1.8,由于机器是64位,所以下载对应的版本:

官网: http://tortoisesvn.tigris.org/  or  http://tortoisesvn.net  

下载地址:http://sourceforge.net/projects/tortoisesvn 

二、软件的安装 
服务端是以.msi后缀名的安装文件,安装过程就不详细介绍了,按照它的提示一步步操作即可。 
我的实际安装路径是D:\Program Files\Subversion 
TortoiseSVN 客户端的安装完成后会提示系统需要重启。 

三、配置过程 
1.创建repository :有两种方法 
方法一:命令行创建 
打开命令窗口, 键入 svnadmin create D:\svnroot\test1 回车, 
会在 目录 D:\svnroot\生成test1文件夹以及文件夹下相应的文件 
方法二:图形化创建 
新建文件夹 D:\svnroot\test2(文件夹下必须是空的),在该文件夹下右击选中TortoiseSVN,如下图 
 
 
上面两种方法都能创建repository ,创建好后生成的目录结构如下: 
 
2.修改配置文件(以上面创建的test1为例:) 
在D:\svnroot\test1\conf\ 目录下会看到 svnserver.conf和passwd两个文件,需要对两个文件作如下修改: 
svnserve.conf 

Java代码   收藏代码
  1. [general]  
  2. ### These options control access to the repository for unauthenticated  
  3. ### and authenticated users.  Valid values are "write""read",  
  4. ### and "none".  The sample settings below are the defaults.  
  5. anon-access = read  
  6. auth-access = write  
  7. ### The password-db option controls the location of the password  
  8. ### database file.  Unless you specify a path starting with a /,  
  9. ### the file's location is relative to the directory containing  
  10. ### this configuration file.  
  11. ### If SASL is enabled (see below), this file will NOT be used.  
  12. ### Uncomment the line below to use the default password file.  
  13. password-db = passwd  
  14. ### The authz-db option controls the location of the authorization  
  15. ### rules for path-based access control.  Unless you specify a path  
  16. ### starting with a /, the file's location is relative to the the  
  17. ### directory containing this file.  If you don't specify an  
  18. ### authz-db, no path-based access control is done.  
  19. ### Uncomment the line below to use the default authorization file.  
  20. # authz-db = authz  
  21. ### This option specifies the authentication realm of the repository.  
  22. ### If two repositories have the same authentication realm, they should  
  23. ### have the same password database, and vice versa.  The default realm  
  24. ### is repository's uuid.  
  25. # realm = My First Repository  

这段配置文件的基本含义为:  
  • anon-access = read 匿名用户的权限,文件中为read表示拥有只读权限
  • auth-access = write 验证通过用户的权限 ,文件中为write表示拥有写的权限
  • 权限包括none、read、write三个值可选,none没有权限,写包含了读权限
  • 去掉#注释时,前面不要有空格
  • password-db = passwd密码数据存放到passwd文件中
  • authz-db = authz 表示版本库中访问路径的规则,即谁只能访问哪个目录下的文件,其他目录下的文件无法访问

passwd 
Java代码   收藏代码
  1. ### This file is an example password file for svnserve.  
  2. ### Its format is similar to that of svnserve.conf. As shown in the  
  3. ### example below it contains one section labelled [users].  
  4. ### The name and password for each user follow, one account per line.  
  5. [users]  
  6. # harry = harryssecret  
  7. # sally = sallyssecret  
  8. michael=michael  

PS:passwd 文件中的配置,如:michael=michael表示用户名为michael,密码为michael 

四、启动subversion服务  
   两种方法:命令启动和服务启动 
1.命令行启动介绍:  
svnserve -d -r D:\svnroot\test1 
默认端口是3690,如果这个端口号已经被占用,则可以通过选项 --listen-port=端口号. 

备注:经过自己的验证这句并没有起作用
2.服务启动介绍: 
安装程序还不能把自己安装成windows服务,需要自己进行手动安装,

新建一个文件mysvn.bat 内容如下:需要将svnserve.exe换成自己的路径,D:\SVNROOT\svngoumin也换成自己的路径

sc create SVNService binPath= "\"C:\Program Files (x86)\Subversion\bin\svnserve.exe\" --service -r D:\SVNROOT\svngoumin" DisplayName= "Subversion" depend= Tcpip start= auto  
sc start Subversion
pause 

注:“=”前不得有空格,后必须有空格。

右击mysvn.bat 文件以管理员身份运行

执行成功会显示:[SC] CreateService 成功 
打开命令窗口键入:services.msc  回车,会在windows的服务中看到刚创建的: 

 
命令的简单解释: 

  • sc是windows自带的服务配置程序,
  • 参数binPath表示svnserve可执行文件的安装路径,由于路径中的"Program Files"带有空格,因此整个路径需要用双引号引起来。而双引号本身是个特殊字符,需要进行转移,因此在路径前后的两个双引号都需要写成\"
  • --service参数表示以windows服务的形式运行,
  • -r/--root指明svn repository的位置,service参数与root参数都作为binPath的一部分,因此与svnserve.exe的路径一起被包含在一对双引号当中,而这对双引号不需要进行转义。
  • displayname表示在windows服务列表中显示的名字
  • depend =Tcpip 表示svnserve服务的运行需要tcpip服务
  • start=auto表示开机后自动运行
  • 若要卸载svn服务,则执行 sc delete svnserve 即可

安装服务后,svnserve要等下次开机时才会自动运行。   

五、导入项目  

这里可能要注意一下防火墙和杀毒软件,为了调试可以先关闭。
图形化操作即可实现具体步骤如下: 
选中需要导入的项目: 
 
输入URL和message 
 
输入用户名和密码 
 
成功导入文件 
 

到此基本完成了svn服务端的安装、配置、启、导入项目等一系列操作。


******************************************************************************************

如果您还需要外网可以访问SVN请再往下看


这个文章介绍了Win7下搭建外网环境的SVN服务器 http://www.cnblogs.com/crazypebble/archive/2011/07/30/2119258.html

我在按照这个文章搭建的时候在配置SVN服务出现了问题,暂时还没得到解决


解决端口冲突的问题:http://blog.csdn.net/threedonkey/article/details/8217480


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值