1.svn服务端在阿里云centos自建
教程:https://www.wlphp.com/?post=196
2.hooks配置:
2.1、建立web服务器的目录
本人web站点所在服务器目录为:/www/wwwroot/zhongliangshancui.wlphp.com
2.2、在svn仓库的hooks目录下,复制post-commit.tmpl为post-commit,最后追加以下:
#!/bin/sh
WEB=/www/wwwroot/zhongliangshancui.wlphp.com/
cd $WEB && /usr/bin/svn update --username admin --password 905507 --no-auth-cache
2.3、给post-commit添加可执行权限
chmod a+x post-commit
3、在web目录先执行一次checkout,之后每次提交后才会自动更新,否则不会自动更新(很重要)
[root@iZ2ze3ral1ugub7rh1w597Z zhongliangshancui.wlphp.com]# /usr/bin/svn checkout svn://39.106.60.28:888/ /www/wwwroot/zhongliangshancui.wlphp.com/ --username admin --password 905507 ----------------------------------------------------------------------- ATTENTION! Your password for authentication realm: <svn://39.106.60.28:888> My First Repository can only be stored to disk unencrypted! You are advised to configure your system so that Subversion can store passwords encrypted, if possible. See the documentation for details. You can avoid future appearances of this warning by setting the value of the 'store-plaintext-passwords' option to either 'yes' or 'no' in '/root/.subversion/servers'. ----------------------------------------------------------------------- Store password unencrypted (yes/no)? yes A 1.txt Checked out revision 1. [root@iZ2ze3ral1ugub7rh1w597Z zhongliangshancui.wlphp.com]#
4.测试本地svn客户端提交,是否能够同步到web目录