Build SVN Linux server

Before:
Requirements: At the request of the art project team, build a SVN version control server for the preservation of subsequent versions

Environment: SVN server: use Linux (more stable, of course, you can also choose Windows for better operation)
SVN client: use TortoiseSVN (big turtle) on Windows
Download link: Download from the official website of the server: http://subversion.apache. org/packages.html
SVN client download: TortoiseSVN: https://tortoisesvn.net/downloads.html
(try to download after connecting to VPN, otherwise it may not be accessible or slow)

1. Enter the Linux server to install the SVM server (subversion)
insert image description here
2. After the installation is complete, switch to cd home in the home directory, create a folder for storing configuration files mkdir meishu (meishu has been created here) and enter
insert image description here
Third, create a warehouse under the meishu folder svnadmin create /home/meishu
insert image description here

Fourth, after querying, you will see that some configuration files have been generated in the directory. Next, we enter the core configuration file conf folder and query
insert image description here

authz is the permission control file
passwd is the account password file
svnserve.conf is the SVN service configuration file

Five, next we configure one by one, first edit the account file to add an account
insert image description here
insert image description here
Six, save and exit, then edit the next permission control file autgz
insert image description here
insert image description here
Of course, the control file can be controlled not only by account, but also by group. it's the same

insert image description here

版本库目录格式:
[<版本库>:/项目/目录]
@<用户组名> = <权限>
<用户名> = <权限>

**

Let me explain about the permissions:
r: means you can download updates but you cannot submit and upload them, otherwise an authentication error will be reported
rw: means you can download updates and submit them
* = : others do not have any permissions

Seven, configure the service file
insert image description here
Open the following 5 comments
anon-access = read #Anonymous users can read
auth-access = write #Authorized users can write
password-db = passwd #Which file to use as account file
authz-db = authz #Use Which file is used as the permission file
realm = /home/svn # authentication space name, the directory where the repository is located

insert image description here
8. After the configuration is complete, save and exit, then start the service
insert image description here
and check if it is up.

In the above startup command, -d means daemon process, -r means execute in the background. If you stop the service, use ps to query kill + process number first.

Nine, let’s start to install the client TortoiseSVN,
insert image description here
insert image description here
choose the installation path here
insert image description here
to install
insert image description here

Ten, after the installation is complete, right-click the mouse to see

insert image description here
Eleven, the first connection needs to be checked out to verify the account password and warehouse path
insert image description here
insert image description here
insert image description here

Additional:

Add restrictions, restricting personnel to fill in the explanatory remarks during the use process, and not less than five characters, otherwise they cannot submit.
1. First, enter the template library hooks and query the directory file,

insert image description here
Second, copy the pre-commit.tmpl file and change it to pre-commit

insert image description here
3. Give the pre-commit authority the highest 777 here
insert image description here
. 4. Then edit the pre-commit file and copy the following code into it to save and exit.

#!/bin/sh#!/bin/sh
# 脚本编写:Ken.xu
REPOS="$1"
TXN="$2"
# 最小注释长度
MIN_REPOS_LEN=5

LOGMSG=`svnlook log -t "$TXN" "$REPOS" | wc -c`
#echo "注释长度:$LOGMSG" 1>&2 
if [ "$LOGMSG" -lt $MIN_REPOS_LEN ] 
then

	echo    " ####################################" 1>&2
	echo -e " ★☆★ 提醒:  注释最少$MIN_REPOS_LEN个字符! ★☆★" 1>&2
	echo -e " 补充注释后,再重新提交!" 1>&2
	echo    " ####################################" 1>&2
	exit 1 
fi
exit 0

insert image description here
insert image description here
result
insert image description here

Guess you like

Origin blog.csdn.net/weixin_44200830/article/details/118496268