Linux (CentOS7) under SVN repository design and build Hook Hook client common actions

Installation svn

yum -y install subversion

Create a directory liuyuanshan

mkdir -p /var/svn/liuyuanshan

Creating yzmedu warehouse

svnadmin create /var/svn/liuyuanshan

Here Insert Picture Description
Here Insert Picture Description

Configuration changes

Under already created repository directory

cd /var/svn/liuyuanshan/conf

conf directory, a total of three storage of important configuration files, as follows:
Here Insert Picture Description
authz: responsible for account management privileges, control whether the account read and write permissions
passwd: responsible for account and password of the user list management
svnserve.conf: svn server configuration file

  1. Edit authz file (note: [/] is a must)
vi authz 
[/] 
liuyuanshan=rw

Here Insert Picture Description
[/]: Represents the root directory, i.e., / var / the svn / liuyuanshan
liuyuanshan = RW: indicates that the user has read and write rights to liuyuanshan root

  1. Edit passwd file
    Here Insert Picture Descriptionas shown above, the user name: liuyuanshan, authentication password: 123

  2. Svnserve.conf edit files (Note: The preceding configuration can not have spaces, must be the top grid write)
    Here Insert Picture Descriptionanon-Access = none: express prohibition of anonymous user access.
    auth-access = write: indicates authorized users have read and write permissions.
    password-db = passswd: Specifies the user name password file, namely passwd file.
    authz-db = authz: assign a rights profile that authz file.
    realm = / var / svn / liuyuanshan : Specifies the authentication domain, i.e., / var / svn / liuyuanshan directory.

Start SVN repository / var / svn / liuyuanshan

Enable liuyuasnhan warehouse and view enabled

svnserve -dr /var/svn/liuyuanshan
ps -ef | grep 'svnserve'

Here Insert Picture Description

SVN Process Viewer and open ports

Remember this time in the open Tencent Ali clouds or cloud SVN default port 3690

pstree |grep svn
netstat -tunpl |grep svn

SVN detection

Here Insert Picture Description

Game Hook, setting m m warehouse to submit updates to the site root hook script

  1. The detection liuyuanshan warehouse version in wechat web directory
cd /usr/local/nginx/html/bbs/wechat
svn co svn://111.231.66.101 ./

Here Insert Picture DescriptionThe successful detection
Here Insert Picture Description

The liuyuanshan warehouse sync files to the web directory

cd /var/svn/liuyuanshan/hooks
cp post-commit.tmpl post-commit
chmod a+x post-commit

Copy the script, and give read-write permissions to perform
Here Insert Picture Descriptionediting post-commit script file

vi post-commit
export LANG=en_US.UTF-8 
svn up --non-interactive --username liuyuanshan --password 123 '/usr/local/nginx/html/bbs/wechat'

Here Insert Picture Description

Test whether the file uploaded to the warehouse while simultaneously synchronized to the WEB directory

Here Insert Picture DescriptionHere Insert Picture Description

Published 41 original articles · won praise 0 · Views 1299

Guess you like

Origin blog.csdn.net/weixin_39218464/article/details/104093559