分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 网页技术

SVN 钩子操作-同步更新web目录

发布时间:2023-09-06 01:47责任编辑:郭大石关键词:SVN

一个简单的钩子演示:也可以网上搜索其他高级的

本次想要达到的功能是:每次用户commit 到仓库后,仓库的钩子会自动把程序又更新的www/的web发布目录

1.现在web目录下创建一个test.com网站目录

[root@wentao13 ~]# cd /var/www/html/[root@wentao13 html]# svn checkout svn://localhost/test.comAuthentication realm: <svn://localhost:3690> 59865037-2557-40be-aa97-d460f66b4c60Password for ‘root‘: Authentication realm: <svn://localhost:3690> 59865037-2557-40be-aa97-d460f66b4c60Username: wentaoPassword for ‘wentao‘: -----------------------------------------------------------------------ATTENTION! ?Your password for authentication realm: ??<svn://localhost:3690> 59865037-2557-40be-aa97-d460f66b4c60can only be stored to disk unencrypted! ?You are advised to configureyour system so that Subversion can store passwords encrypted, ifpossible. ?See the documentation for details.You can avoid future appearances of this warning by setting the valueof the ‘store-plaintext-passwords‘ option to either ‘yes‘ or ‘no‘ in‘/root/.subversion/servers‘.-----------------------------------------------------------------------Store password unencrypted (yes/no)? yA ???test.com/2.txtA ???test.com/3.txtA ???test.com/test.phpA ???test.com/1.phpChecked out revision 8.[root@wentao13 html]# 

按照提示需要输入root 密码,和svn授权用户名和密码

然后配置hook文件夹的脚本

[root@wentao13 hooks]# pwd/root/svnRepo/test.com/hooks[root@wentao13 hooks]# lltotal 36-rw-r--r--. 1 root root 1977 Mar 29 08:59 post-commit.tmpl-rw-r--r--. 1 root root 1638 Mar 29 08:59 post-lock.tmpl-rw-r--r--. 1 root root 2289 Mar 29 08:59 post-revprop-change.tmpl-rw-r--r--. 1 root root 1567 Mar 29 08:59 post-unlock.tmpl-rw-r--r--. 1 root root 3426 Mar 29 08:59 pre-commit.tmpl-rw-r--r--. 1 root root 2434 Mar 29 08:59 pre-lock.tmpl-rw-r--r--. 1 root root 2786 Mar 29 08:59 pre-revprop-change.tmpl-rw-r--r--. 1 root root 2122 Mar 29 08:59 pre-unlock.tmpl-rw-r--r--. 1 root root 2780 Mar 29 08:59 start-commit.tmpl[root@wentao13 hooks]# 

把下面的钩子文件模板改成可执行文件

[root@wentao13 hooks]# cp post-commit.tmpl post-commit[root@wentao13 hooks]# chmod +x post-commit[root@wentao13 hooks]# 

 vim post-commit   添加下面内容:

export LANG=en_US.UTF-8
/usr/bin/svn update /var/www/html/test.com --username wentao --password 123456

 网站发布目录同步更新

SVN 钩子操作-同步更新web目录

原文地址:https://www.cnblogs.com/fps2tao/p/8673258.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved