1、创建一个仓库(repository):
svnadmin create D:\svn\repository
2、启动服务:
svnserve -d -r D:\svn\repository
3、import命令:
svn import svn://localhost
4、checkout命令:
svn checkout svn://localhost/project2
5、cleanup命令,清除锁定:
svn cleanup
6、commit命令:
svn commit test2.txt -F C:\log.txt
7、svn的验证机制:
修改conf目录下的几个文件
8、svn备份
svnadmin hotcopy D:\svn\repository D:\backup
9、svn创建虚拟目录
svn mkdir
svn整合Apache
1.安装Apache(注意版本问题,2.0或2.2版本),如果安装失败,出现端口被占用的情况,用netstat -nab查看,并关闭掉占用了80端口的线程。常见程序:迅雷、peer.exe
2.进入subversion的安装目录的bin目录,拷贝mod_authz_svn.so和mod_dav_svn.so两个文件到Apache2的安装目录下的modules目录找到第145和146行,去掉前面的注释即去年#。并在第173行增加两行LoadModule dav_svn_module modules/mod_dav_svn.so、
LoadModule authz_svn_module modules/mod_authz_svn.so,在文件的最后,增加如下内容:
<Location /svn>
DAV svn
SVNPath D:\server\svn\repository
</Location>
3.改变认证方式,使匿名用户无法登陆
<Location /svn>
DAV svn
SVNPath D:\server\svn\repository
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile "D:\server\svn\passwd\passwords"
Require valid-user
</Location>
将apache2的bin目录加入到环境变量path中,使用htpasswd D:\server\svn\passwd\passwords username可以往passwords文件中增加用户和密码。
4.更改httpd.conf文件
<Location /svn>
DAV svn
SVNParentPath D:\server\svn\repository
AuthzSVNAccessFile D:\server\svn\passwd\policy
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile "D:\server\svn\passwd\passwords"
Require valid-user
</Location>
建立policy文件,添加如下内容:
[helloworld:/]
hello=r
google=
5.使用组来管理权限
改变policy文件的内容
[groups]
developers=hello,google
testers=microsoft
[helloworld:/]
@developers=rw
@testers=r
[subsvn:/]
@developers=rw
@testers=
For an Apache server here's the essentials:
1. Copy bin/mod_dav_svn.so and bin/mod_authz_svn.so to the Apache modules directory.
2. Add the Subversion/bin directory to the SYSTEM PATH and reboot so all the Subversion
support dll's are visible to the Apache service.
3. Edit the Apache configuration file (httpd.conf) and make the following changes:
3a. Uncomment the following two lines:
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_module modules/mod_dav.so
3b. Add the following two lines to the end of the LoadModule section:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
3c. Add the following to end of the file. Note: This Location directive is a
minimal example with no authentication directives. For other options,
especially authentication options, see the Subversion INSTALL file,
the Subversion Book, or the TortoiseSVN Manual.
<Location /svn>
DAV svn
SVNPath your/repository/path
</Location>