1. 下载SVN Server ; 添加 SVN Sever的安装目录\bin 目录到 path目录下, 我的电脑-》属性 -》高级-》环境变量 -》path
2. 客户端安装 Tortorise SVN
3. 建立SVN 的 repository, 就是项目代码仓库, 以后的的所有同步的代码在服务器上存放在这个仓库中
两种方法:
1) 在Server端 开始 -> 运行 输入 cmd -> svnadmin create E:\svndemo\repository
这个路径是你服务器上的软件仓库的路径
2) 使用TortoiseSVN , 在目录E:\svndemo\repository下"右键->TortoiseSVN->CreateRepositoryhere...“
4. SVN 用户访问权限配置
最简单的权限配置, 进入 软件仓库中(E:\svndemo\repository) 中,进入conf目录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
anon-access = write
5. 添加 SVN Server至服务中
注意以下为 windows的cmd 命令, 命令的参数中有空格的,注意一下空格, 特别是sc create中的 ”=“后有空格。
创建服务:
sc create "SVND" binPath= "\"C:\Program Files\Subversion\bin\svnserve.exe\" --service --root E:\svndemo\repository" start= demand DisplayName= "SVNDServer"
rem --root 后的目录是 服务器中软件仓库路径
删除该服务
sc delete "SVND"
启动该服务
sc start "SVND"
停止该服务
sc stop "SVND"
6. 使用TortoiseSVN 向svnserver上传代码, 下载代码,更新代码操作
服务器上使用TortoiseSVN:
更新到最新代码: 进入一个文件中,右键单击空白地方,选择 SVN Checkout ,在URL of Repository 输入 svn://localhost/ 单击确定,OK。
上传代码: 在该目录中添加一个文件, 右键单击空白地方,选择SVN Commit, 勾上所有想上传的代码,即可单击确定。
客户端机器上做如上操作时,将svn://localhost/ 改为 svn://ip/即可