进入到hooks目录
[root@li538-34 default]# cd /opt/svn [root@li538-34 svn]# ll total 4 drwxr-xr-x 6 root root 4096 Feb 24 06:38 repos [root@li538-34 svn]# cd repos [root@li538-34 repos]# ll total 24 drwxr-xr-x 2 root root 4096 Feb 24 07:47 conf drwxr-sr-x 6 root root 4096 Feb 24 08:01 db -r--r--r-- 1 root root 2 Feb 24 06:31 format drwxr-xr-x 2 root root 4096 Feb 24 07:24 hooks drwxr-xr-x 2 root root 4096 Feb 24 06:31 locks -rw-r--r-- 1 root root 229 Feb 24 06:31 README.txt [root@li538-34 repos]# cd hook -bash: cd: hook: No such file or directory [root@li538-34 repos]# cd hooks [root@li538-34 hooks]# ll total 40 -rwxrwxrwx 1 root root 138 Feb 24 07:21 post-commit -rw-r--r-- 1 root root 1977 Feb 24 06:31 post-commit.tmpl -rw-r--r-- 1 root root 1638 Feb 24 06:31 post-lock.tmpl -rw-r--r-- 1 root root 2289 Feb 24 06:31 post-revprop-change.tmpl -rw-r--r-- 1 root root 1567 Feb 24 06:31 post-unlock.tmpl -rw-r--r-- 1 root root 3426 Feb 24 06:31 pre-commit.tmpl -rw-r--r-- 1 root root 2410 Feb 24 06:31 pre-lock.tmpl -rw-r--r-- 1 root root 2786 Feb 24 06:31 pre-revprop-change.tmpl -rw-r--r-- 1 root root 2100 Feb 24 06:31 pre-unlock.tmpl -rw-r--r-- 1 root root 2780 Feb 24 06:31 start-commit.tmpl [root@li538-34 hooks]#
正常情况下没有post-commit 文件,我这里已经添加了。
post-commit 文件代码
#!/bin/sh export LANG=zh_CN.UTF-8 WEB=/home/wwwroot/default svn update $WEB --username ningyuqiao --password ningyuqiao --no-auth-cache ~ ~
包括网站根目录,svn一个用户名和密码。
然后给post-commit 执行权限,我直接给了777。
然后进入网站根目录
svn checkout svn:// ip address . #输入ip地址,然后注意后面有个.代表当前目录
到此为止基本搞定,大家有问题给我留言。
原文地址:http://ningyuqiao.blog.51cto.com/5581274/1615070