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 ( ...
随机推荐
- 算法(5)Jump Game
题目:非负数的数组,每个数组元素代表这你能最大跨越多少步,初始在0的位置,问,能不能正好调到数组的最后一位! https://leetcode.com/problems/jump-game/#/des ...
- RegExp & bug
RegExp & bug translated bug // OK && tranlate `/` let new_obj_reg = new RegExp(`^(([^< ...
- [Java] Java常见错误
1.处理java错误"编码 GBK 的不可映射字符" (1)首先记事本打开java源文件 (2)然后另存为,选择ANSI编码 (3)覆盖 (4)再试一下,ok,编译通过.
- jdbc连接oracle语法
public class LangDemo { public static void main(String[] args) throws Exception{ try { //加载驱动 Class. ...
- AJAX基本演示使用
Servlet配置 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="h ...
- 【loj6191】「美团 CodeM 复赛」配对游戏 概率期望dp
题目描述 n次向一个栈中加入0或1中随机1个,如果一次加入0时栈顶元素为1,则将这两个元素弹栈.问最终栈中元素个数的期望是多少. 输入 一行一个正整数 n . 输出 一行一个实数,表示期望剩下的人数, ...
- [HDU3710] Battle Over Cities [树链剖分+线段树+并查集+kruskal+思维]
题面 一句话题意: 给定一张 N 个点, M 条边的无向连通图, 每条边上有边权 w . 求删去任意一个点后的最小生成树的边权之和. 思路 首先肯定要$kruskal$一下 考虑$MST$里面去掉一个 ...
- Angular 遍历循环数组
var app = angular.module('Mywind',['ui.router']) app.controller('Myautumn',function($scope,$http,$fi ...
- 转:A Painless Q-learning Tutorial (一个 Q-learning 算法的简明教程)
demo 参见 MDP DEMO 本文是对 http://mnemstudio.org/path-finding-q-learning-tutorial.htm 的翻译,共分两部分,第一部分为中文 ...
- 河南省第十届省赛 Plumbing the depth of lake (模拟)
title: Plumbing the depth of lake 河南省第十届省赛 题目描述: There is a mysterious lake in the north of Tibet. A ...