linux svn如何更新代码,linux下svn搭建以及服务器自动更新代码

第一步   安装SVN   学习资源分享地址

yum -y install subversion

输入svnserve --version 查看是否安装成功

第二步   创建版本库目录和版本库  firsttest为项目名称 学习资源分享地址

cd /home/svn/

svnadmin create firsttest

安装好后会产生firsttest目录

第三步   修改auth,添加svn用户,假如我添加两个用户是user1和user2  学习资源分享地址

cd firsttest/conf

vi   authz

以下是文件内容

[groups]

# harry_and_sally = harry,sally

# harry_sally_and_joe = harry,sally,&joe

admin=user1,user2  //增加分组

# [repository:/baz/fuz]

# @harry_and_sally = rw

# * = r

[firsttest:/]   //目录和项目名称对应 firsttest

@admin=rw    分配权限

修改完后保存退出  按esc后输入:wq

第四步 添加用户账户密码 学习资源分享地址

vi passwd

### This file is an example password file for svnserve.

### Its format is similar to that of svnserve.conf. As shown in the

### example below it contains one section labelled [users].

### The name and password for each user follow, one account per line.

[users]

# harry = harryssecret

# sally = sallyssecret

user1=888888

user2=888888

第五步 添加目录权限,修改svnserve.conf 学习资源分享地址​​​​​​​

[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 = read         去掉#并修改为 anon-access=none

# auth-access = write        去掉#

### 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 = /home/svn/firsttest/ svn

到这里svn就已经安装完成了

启动svn

svnserve -d -r /home/svn/

然后在客户端新建项目目录

svn://你的服务器id/firsttest

ad2e6ed535f7224c86ad948a4937c75f.png

输入账户密码后就更新完毕,随便创建文件上传一个到svn

然后回到服务器 你的项目目录/var/www/

cd /

svn co svn://你的服务器id/firsttest  /var/www/

之后输入用户名密码即可,恭喜搭建完成

第六步 安装服务器自动更新脚本  学习资源分享地址​​​​​​​

cd /home/svn/firsttest/hooks

vi post-commit

#!/bin/sh

S="$1"

REV="$2"

export LC_ALL="zh_CN.UTF-8"

export LANG="en_US.UTF-8"

SVN_PATH=/usr/bin                          #svn安装路径

WEB_PATH=/var/www/           #web项目所在

SVN_USER=user1                          #svn用户名

SVN_PASS=888888                          #svn密码

LOG_PATH=/tmp/svn.log

$SVN_PATH/svn update $WEB_PATH || exit 1

exit 0

到这步你已经实现完所有步骤

之前回到客户端上传文件,服务器也会同步更新了

溜溜溜,恭喜你又多掌握一项技能

学习资源分享地址​​​​​​​:http://dkfmsc.fun/

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值