SVN Create Repository


Use the svn command to create a repository:

[example@centos6 ~]# svnadmin create /opt/svn/example01
[example@centos6 ~]# ll /opt/svn/example01/
total 24
drwxr-xr-x 2 root root 4096 2016/08/23 16:31:06 conf
drwxr-sr-x 6 root root 4096 2016/08/23 16:31:06 db
-r--r--r-- 1 root root    2 2016/08/23 16:31:06 format
drwxr-xr-x 2 root root 4096 2016/08/23 16:31:06 hooks
drwxr-xr-x 2 root root 4096 2016/08/23 16:31:06 locks
-rw-r--r-- 1 root root  229 2016/08/23 16:31:06 README.txt

Enter the /opt/svn/example01/conf directory and modify the default configuration files, including svnserve.conf, passwd, and authz to configure related users and permissions.

1. svn service configuration file svnserve.conf

The svn service configuration file is the file conf/svnserve.conf in the repository directory. This file consists of only one [general] configuration section.

[general]
anon-access = none
auth-access = write
password-db = /home/svn/passwd
authz-db = /home/svn/authz
realm = tiku 
  • anon-access:Controls the access permissions of unauthenticated users to the repository. The allowed values are "write", "read", and "none". That is, "write" means readable and writable, "read" means read-only, and "none" means no access permission. Default value: read.

  • auth-access:Controls the access permissions of authenticated users to the repository. The allowed values are "write", "read", and "none". That is, "write" means readable and writable, "read" means read-only, and "none" means no access permission. Default value: write.

  • authz-db:Specifies the permission configuration file name. Through this file, path-based access control can be implemented. Unless an absolute path is specified, the file location is a path relative to the conf directory. Default value: authz.

  • realm:Specifies the authentication realm of the repository, i.e., the authentication realm name prompted at login. If two repositories have the same authentication realm, it is recommended to use the same username/password data file. Default value: a UUID (Universal Unique IDentifier, globally unique identifier).

2. Username/password file passwd

The username/password file is specified by the password-db configuration item in svnserve.conf, and defaults to passwd in the conf directory. This file consists of only one [users] configuration section.

The configuration line format of the [users] configuration section is as follows:

<username> = <password>
[users]
admin = admin
thinker = 123456

3. Permission configuration file

The permission configuration file is specified by the authz-db configuration item in svnserve.conf, and defaults to authz in the conf directory. This configuration file consists of a [groups] configuration section and several repository path permission sections.

The configuration line format in the [groups] configuration section is as follows:

<user group> = <user list>

The section name format of the repository path permission section is as follows:

[<repository name>:<path>]
[groups]
g_admin = admin,thinker

[admintools:/]
@g_admin = rw
* =

[test:/home/thinker]
thinker = rw
* = r

This example usessvnserve -d -r /opt/svnto start SVN in multi-repository svnserve mode, so the URL is:svn://192.168.0.1/example01。

Other extensions