svn win

一、安装SVN服务器,到http://subversion.apache.org/packages.html上下载windows版的SVN,并安装,在命令行下运行svn命令,以下因此,则svn服务器安装成功。html

  1. C:\Documents and Settings\Administrator>svn   apache

  2. 使用“svn help”获得用法。  windows

           

二、建立仓库Repository:运行命令服务器

  1. C:\Documents and Settings\Administrator>svnadmin create G:\svn  less

 

  该命令会在G盘下自动建立一个名字为svn的文件夹,该文件中的内容如非必要,不要手动修改,其内容是由svn自动维护的,各自得用途: 

  conf里文件夹中都是这个仓库的配置文件。 

  db是真正用来存储数据版本的地方。 

  hooks文件夹中的内容用以定义某些动做触发的hook脚本。 

  locks中的文件用于在某些分支或者文件上加锁。    

三、建立用户:进入conf目录(本例中是G:\svn\conf),打开svnserve.conf文件,找到以下内容:tcp

  1. [general]   ide

  2. ### These options control access to the repository for unauthenticated   svn

  3. ### and authenticated users.  Valid values are "write""read",   this

  4. ### and "none".  The sample settings below are the defaults.   spa

  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  

   将

  1. # anon-access = read   

  2. # auth-access = write   

  1. # password-db = passwd  

  中的注释去掉修改成

 

  1. anon-access = read   

  2. auth-access = write   

  1. password-db = passwd  

 

 这样就可使用passwd文件中的用户了。

  打开passwd(和svnserve.conf在同目录下),能够看到,建立好的两个用户都被注释掉了,能够修改者两个用户,也能够新建本身的用户,这里我新建立了一个本身的用户,passwd文件被修改成:

  1. [users]  

  2. # harry = harryssecret  

  3. # sally = sallyssecret  

  4. admin=admin  

四、启动SVN服务器,运行命令svnserve -d -r G:\svn,就能够启动服务

  1. C:\Documents and Settings\Administrator>svnserve -d -r G:\svn  

   -d表示后台运行,-r表示以超级管理员的方式运行,G:\svn是指SVN所管理的仓库。

五、配置SVN服务器开机启动

  打开一个DOS窗口,在任意目录下执行下面的命令:

 

  1. //在命令中的每个等号后面都要有一个空格不然命令执行失败  

  2. sc create svnserve binPath= "\"C:\Program Files\Subversion\bin\svnserve.exe\" --service --root d:\svnstore" displayname= "SVN Serve" depend= Tcpip start= auto  

    

  其中,sc是windows自带的服务配置程序,参数binPath表示svnserve可执行文件的安装路径,因为路径中的"Program Files"带有空格,所以整个路径须要用双引号引发来。而双引号自己是个特殊字符,须要进行转移,所以在路径先后的两个双引号都须要写成\"

  --service参数表示以windows服务的形式运行,--root指明svn repository的位置,service参数与root参数都做为binPath的一部分,所以与svnserve.exe的路径一块儿被包含在一对双引号当中,而这对双引号不须要进行转义。

displayname表示在windows服务列表中显示的名字, depend =Tcpip 表示svnserve服务的运行须要tcpip服务,start=auto表示开机后自动运行。

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

  若要卸载svn服务,则执行 sc delete svnserve 便可

相关文章
相关标签/搜索