重新加载apache配置:
service httpd>四、配置svn post-commit钩子:
当我们希望在像svn数据仓库提交新版本时,自动将更新同步到我们的网站,这时我们可以使用svn钩子,svn钩子必须放在svn数据仓库的hooks目录下,这里我们要添加是svn commit(svn提交)钩子post-commit:
vim /storage/svn/aiezu/hooks/post-commit,添加如下内容:
#!/bin/bash
export LANG=”zh_CN.UTF-8″
export LANG=”zh_CN.UTF-8″
export LC_CTYPE=”zh_CN.UTF-8″
svn update /storage/web/aiezu/ –username=svnuser –password=svnpass –non-interactive
授予可执行权限:
chmod a+x /storage/svn/aiezu/hooks/post-commit 检出版本库:
svn checkout http://www.aiezu.com/svn/aiezu /storage/web/aiezu/五、常见错误及其解答:
1、svn checkout(svn检出)时错误一:
The URI does not contain the name of a repository. [403, #190001] 解答:这是由于subversion.conf文件中SVNParentPath路径设置不正确引起的,SVNParentPath路径必须为svnadmin create生成数据仓库路劲的父目录,如上面建立数据仓库的命令为svnadmin create /storage/svn/aiezu,则SVNParentPath为/storage/svn。
2、svn checkout时错误二:
Unable to connect to a repository at URL ‘http://www.aiezu.com/svn’
Access to ‘http://www.aiezu.com/svn’ forbidden
解答:svn数据仓库的SVN URL地址不正确,当subversion.conf中设置SVNListParentPath on时,SVN URL地址为SVNParentPath下的具体数据仓库,而不是SVNParentPath指定的目录。
3、svn checkout时错误三:
Unable to connect to a repository at URL http://www.aiezu.com/svn/test’
Could not open the requested SVN filesystem
解答:svn数据仓库的SVN URL地址不正确,在SVNParentPath下找不到SVN URL指定的数据仓库。
4、svn提交(svn commit)时出现如下错误:
post-commit hook failed (exit code 1) with output:
svn: Can’t open file ‘/storage/web/aiezu/.svn/lock’: Permission denied
解答:这是svn提交调用的post-commit钩子没有权限写/storage/web/aiezu/.svn目录引起的。apache集成的svn是使用apache用户调用post-commit钩子的,所以必须保证apache用户对.svn有写权限, 执行chown -R apache.apache /storage/web/aiezu就可以了。