Mac OS X Lion 10.7.2上配置svn服务器

时间:2022-09-19 17:22:43

0. 应用程序-->系统偏好设置-->共享-->勾选“web共享”

1. 修改httpd.conf(在Macbook下位于 /etc/apache2/httpd.conf)

添加

LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so
LoadModule authz_svn_module libexec/apache2/mod_authz_svn.so
Include /private/etc/apache2/extra/httpd-svn.conf

2. 创建httpd-svn.conf文件(/etc/apache2/extra/httpd-svn.conf)

<Location /svn >
DAV svn
#SVNParentPath "/Users/cheungquentin/svnRepository"
SVNPath "/Users/cheungquentin/svnRepository"
# user authentication
AuthType Basic
AuthName "Subversion repository"
AuthUserFile "/Users/cheungquentin/svnRepository/conf/htsvn.users"
# only authenticated users may access the repository
Require valid-user
</Location>

3. 初始化SVN源码库

$ svnadmin create /Users/cheungquentin/svnRepository

4. 启动服务器。

$ svnserve -d -r /Users/cheungquentin/svnRepository
没有任何提示就说明启动成功了

5. 创建 /Users/cheungquentin/svnRepository/conf/htsvn.users文件

6. 添加用户
sudo htpasswd -c /Users/cheungquentin/svnRepository/conf/htsvn.users Quentin

7. 重启apache
sudo apachectl restart

8. 测试:
http://localhost/svn

 

PS.

svnserve的常规命令:
http://tortoisesvn.net/docs/nightly/TortoiseSVN_zh_CN/tsvn-serversetup-svnserve.html
启动(需要用root权限):
svnserve -d -r /你的代码仓库地址/
关闭/重启:lsof -i :3690 
查看svn是否启动ps aux |grep ‘svn’ 查找所有svn启动的进程id,
kill-9 3703 杀死3703这个查找到的svn进程

/Users/cheungquentin/svnRepository 权限改成读写 否则提交可能失败