Window下配置SVN服务器与客户端
我将详细的介绍一下关于svn的配置,下面的经过是我自己在配置过程中遇到的问题及解决方案.
如何配置svn服务器:
前提条件:
下载最新的svn服务器: svn-1.4.5-setup.rar
下载最新的svn客户端: TortoiseSVN-1.4.5.10425-win32-svn-1.4.5.rar
下载配置svn服务成window service自动运行的工具: SVNService.rar 配置的步骤如下前提是将本机作为一个服务器:
1.下载并安装svn1.4.5-setup.rar, 假设你安装在:C:/Program Files/Subversion目录下,为系统默认的.
2. 建立Repository, 我们可以先在本机上建立一个文件目录如e:/svnroot, 之后再打开命令行窗口, 输入svnadmin create e:/svnroot/project,
3.配置Repository,进入Repository目录,这里是e:/svnroot/projects, 你会看到conf目录,进入该目录,你会看到 svnserver.conf和passwd两个文件.
对两个文件作如下修改:
svnserve.conf [general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
anon-access = read
auth-access = write
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the conf directory.
### Uncomment the line below to use the default password file.
password-db = passwd
含义是: 未验证用户无任何权限 (如果把none修改为read就是给予读权限) 已验证用户给予写权限 (当然也能读) 密码数据存放到passwd文件中 passwd [users] harry = harryssecret sally = sallyssecret maoyg=maoyg 注意最后passwd中的配置,一个用户以行,如:maoyg=maoyg 表示用户名为maoyg,密码为maoyg的一个用户。
4.启动subversion服务两种方式启动:
(1).以Dos的命令行方式运行:svnserve -d -r e:/svnroot/默认端口是3690,如果不幸这个端口被别的程序暂用,可以通过选项 --listem --port=绑定端口. 我的电脑端口因为没有被别的程序占用,所以输入上面的svnserve -d -r e:/svnroot就可以.
(2)subversion服务:默认情况下载window service中是没有的,必须通过svnservice -install -d -r
5. 你可以安装TortoiseSVN程序,现在可以用客户端来访问刚刚配置好的服务器了,在IE窗口中输入下列的URL格式:
可以进行一些客户端的简单日常操作:
要取得当前的服务器的最新版本文件,可以使用SVN updated.
要将修改的文件更新到服务器,选择SVN submit 即可(谨慎的话先更新到最新版本后再提交).
遇到的第一个问题就是:
svnserve.conf:12: Option expected,它的解决方法如下:
经常有新手配置基于svnserve的subversion服务器后,在客户端访问subversion版本库时出现这个错误: svnserve.conf:12: Option expected 为什么会出现这个错误呢,就是因为subversion读取配置文件svnserve.conf时,无法识别有前置空格的配置文件,
如
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.
### access through http: and/or file: URLs, then this file is
### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.
[general]
### These options control access to the repository for unauthenticated
### and authenticated users.
### and "none".
anon-access = read
auth-access = write
像上面的配置文件中,anon-access是顶行的,没问题,而auth-access就存在前置空格,会导致这个错误。要避免出现这个错误,应该在去掉这些行前的#时,也要顺手去掉前面的空格,所以问题就解决了.
遇到的第二个问题是:启动服务的方式,我们在之前使用的是第一个启动方式,我觉得有点麻烦,就是一直都得开一个Dos窗口,这样不方便工作,所以就想到用别的办法来替换了.
SVNService(将svn作为windows服务运行的工具) 将你们下载的第三个软件如SVNServices.rar解压后,把SVNServices.exe放在subversion的bin目录下面,我的是在C:/Program Files/Subversion/bin.
Usage instructions:
SVNService -?
SVNService -install <svnserve parameters>
SVNService -setup <svnserve parameters>
SVNService -remove
SVNService -debug
例如, 你所有项目都在e:/svnroot下,只介绍下面两个命令的用法: 安装时用
参考文章有:
http://www.cnblogs.com/changchangcc520/archive/2007/11/06/950867.html