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 ( ...
随机推荐
- [Elasticsearch] 多字段搜索 (三) - multi_match查询和多数字段
multi_match查询 multi_match查询提供了一个简便的方法用来对多个字段执行相同的查询. NOTE 存在几种类型的multi_match查询,其中的3种正好和在"了解你的数据 ...
- elasticsearch 6.2.3安装ik分词
下载 zip文件 上传到服务器 https://github.com/medcl/elasticsearch-analysis-ik/releases unzip elasticsearch-anal ...
- 用AngularJS操作DOM
在angular中使用第三方插件时最好都封装到指令(directives)中去,DOM操作也最好都解构到指令中. <!DOCTYPE html> <html lang="e ...
- timeSetEvent()函数
原文链接地址:http://www.cnblogs.com/kangwang1988/archive/2010/09/16/1827872.html 微软公司在其多媒体Windows中提供了精确定时器 ...
- Spring随笔 —— IOC配置的三种不同方式简介
在spring framework中,IOC的配置是最基础的部分,常见的配置方式有基于xml文件和基于注解的配置方式.除了这两种配置方式之外,今天这里再介绍另一种配置方式,先用小demo重温下我们熟悉 ...
- lwIP内存管理机制
lwip的内存管理机制,我们以enet_lwip这个例程为例. 在使用lwip的时候,我们可以使用两种形式的内存,一种是heap(mem.c文件-mem_malloc()),一种是pool(memp. ...
- 【转载】惊天大悲剧-Hadoop的rmr和trash
转自:http://java-doom.iteye.com/blog/1898000 这两天在操作Hadoop集群时,由于一个误操作,制作了一个天大的悲剧 不小心把Hadoop集群上的所有文件全部删除 ...
- js实现日历
有这样一个普通的日历需求 第一反应就是找插件,结果找到了,但是改起来非常麻烦,然后查下实现的原理,发现原来很简单,于是自己实现了一个. 首先分析一下这个组件,每页显示的是 当前月的所有日期及所占据的行 ...
- POJ1061-青蛙的约会---扩展欧几里德算法求最小整数解
扩展欧几里得算法模板 #include <cstdio> #include <cstring> #define ll long long using namespace std ...
- Spring - IoC(4): p-namespace & c-namespace
p 命名空间 p 命名空间允许你使用 bean 元素的属性而不是 <property/>子元素来描述 Bean 实例的属性值.从 Spring2.0 开始,Spring 支持基于 XML ...