linux 设置svn钩子实现自动更新
一、svn安装设置
1.安装svn启动
yum install subversion
2.建个svn的根目录,因为项目不止一个
mkdir -p /home/svn/
3.新建一个新的空的版本仓库(subversion repository)
svnadmin create /home/svn/repos
4.初始化版本仓库中的目录
svn import /home/svn/repos/ file:///home/svnt/repos -m “初始化SVN目录”
5.添加用户
在/home/svn/svntest/repos/conf/passwd 添加
[users]
whx = whx
wj = wj
6.设置权限
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
### - a single user,
### - a group of users defined in a special [groups] section,
### - an alias defined in a special [aliases] section,
### - all authenticated users, using the '$authenticated' token,
### - only anonymous users, using the '$anonymous' token,
### - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### (''). [aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average [groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe # [/foo/bar]
# harry = rw
# &joe = r
# * =
[repos:/]
whx = rw
wj = rw
* =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
7.修改svnserve.conf文件,让用户和策略配置升效.
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository. (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.) ### Visit http://subversion.tigris.org/ for more information. [general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
anon-access = none
auth-access = write
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file. If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
# realm = My First Repository [sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
# use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256
8.开启服务仓库
svnserve -d -r /home/svn
二、设置钩子自动更新
1.创建站点目录
/home/www/web
2.建立钩子脚本
在/home/svn/repos/hooks 目录下创建 post-commit,内容如下
#!/bin/bash
REPOS="$1"
REV="$2"
export LANG=zh_CN.UTF-8
echo "Code Deployed at `date "+%Y-%m-%d %H:%M"`" >> /home/svn/repos/hooks/deploy_log
/usr/bin/svn update --username user1 --password user1 /home/www/web
~
3.Checkout一份代码到站点目录
/usr/bin/svn checkout svn://localhost/repos /home/www/web
4.然后用windows svn客户端checkout一份代码到本地目录,然后在这个目录新增一个文件。那么就可以看到
/home/www/web 目录下就新增了这个文件了。
linux 设置svn钩子实现自动更新的更多相关文章
- Linux下搭建SVN服务器及自动更新项目文件到web目录(www)的方法
首先搭建SVN服务器 1,安装SVN服务端 直接用apt-get或yum安装subversion即可(当然也可以自己去官方下载安装) sudo apt-get install subversion ...
- SVN跨服务器自动更新--实现文件分发
目标:SVN版本库提交,服务器中的工作拷贝能自动update. 实现方法:subversion, curl,php脚本实现,并且入mysql库来进行管理.改hosts文件来进行访问!提交触发钩子脚本时 ...
- 设置SVN hooks实现自动发布
# CentOS下安装SVN yum -y install subversion svnserve --version cd /home/ mkdir svn cd svn/ /usr/bin/svn ...
- SVN 钩子操作-同步更新web目录
一个简单的钩子演示:也可以网上搜索其他高级的 本次想要达到的功能是:每次用户commit 到仓库后,仓库的钩子会自动把程序又更新的www/的web发布目录 1.现在web目录下创建一个test.com ...
- CentOS 7 环境下部署 SVN 并实现自动更新(版本库放在Tomcat下)
1.安装 SVN 1.1先检查是否有安装 svn rpm -qa subversion #没有什么显示就说明没有安装过yum remove subversion #如果有安装就运行删除老版本yum i ...
- centos 6.8 设置svn钩子同步至web目录
1.在web目录创建项目目录 mkdir ./opt/wwwroot/项目名称 2.使用svn检出项目文件 svn checkout svn://localhost:/项目名称 3.设置svn库中钩子 ...
- Linux - 设置光盘,开机自动挂载。
设置光盘,开机自动挂载. 挂载, 在linux操作系统中, 挂载是指将一个设备(通常是存储设备)挂接到一个已存在的目录上. 我们要访问存储设备中的文件,必须将文件所在的分区挂载到一个已存在的目录上, ...
- 在linux上搭建SVN服务器并自动更新至WEB目录
1.仓库放在 /var/svn/ 目录下,并且仓库名为 project 2.创建用户组user,该组下添加两个成员user1.user2,密码直接用用户名,两用户可以checkout代码和提交代码 3 ...
- linux svn hooks代码自动更新至项目
由于开发移动端web,ui需要及时看到样式变化,所以通过svn hooks(钩子)来提交文件,然后再把文件同步到测试服务器项目目录,步骤如下: 1.进入 /home/svn/cmall/hooks ( ...
随机推荐
- http请求的过程
http请求格式: http请求格式由四部分组成,分别是:请求行,请求头,空行,消息体,每个部分占一行. 请求行是消息体的第一行,由三部分组成,分别是:请求方法,请求资源的url,http的版本号. ...
- js canvas captcha
js canvas captcha https://thejackalofjavascript.com/building-a-captcha-using-html5-canvas/ https://a ...
- Java学习全攻略-->阅读官方文档
一直感觉Java的官方文档有些杂乱,最近特意整理了一下,仅供参考. 入口 Oracle官方文档入口:http://docs.oracle.com/.下级页面这边只整理了JavaEE跟JavaSE的文档 ...
- P1118 [USACO06FEB]数字三角形`Backward Digit Su`…
题目描述 FJ and his cows enjoy playing a mental game. They write down the numbers from 11 to N(1 \le N \ ...
- [Leetcode] Convert sorted list to binary search tree 将排好的链表转成二叉搜索树
---恢复内容开始--- Given a singly linked list where elements are sorted in ascending order, convert it to ...
- 【COGS 461】[网络流24题] 餐巾 最小费用最大流
既然是最小费用最大流我们就用最大流来限制其一定能把每天跑满,那么把每个表示天的点向T连流量为其所需餐巾,费用为0的边,然后又与每天的餐巾对于买是无限制的因此从S向每个表示天的点连流量为INF,费用为一 ...
- HDU 2639 01背包求第k大
Bone Collector II Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others ...
- [poj 3436]最大流+输出结果每条边流量
题目链接:http://poj.org/problem?id=3436 大力套kuangbin板过了orz #include<cstdio> #include<cstring> ...
- 简单配置oracle11g
一.配置 Systemd file(开机可以自动oracle,也可以查看启动状态) a.定义环境变量 [oracle@ol7 ~]$ cat /etc/sysconfig/DB11G.oracledb ...
- js删除一个父元素下面的所有子元素
比如<div id="ok"><button tpye='button'>111111</button><p>22222</p ...