Setting up the SVN Server

SVN is installed on the Mac by default, we just need to configure it and enable it. We can verify whether SVN is installed, open the terminal, and enter the command

svnserve --version
Copy the code

  • After a file is uploaded to the SVN version library, the uploaded file is not stored in its original format, but is compressed by the SVN in a customized format into version library data and stored in the version library.
  • In FSFS format, this data is stored in the db directory of the repository, where revs and Revprops store the variance data and logs for each commit, respectively.

Create a code repository to store the code uploaded by the client

1. Create a SVN directory

Use the terminal or create a path to the SVN directly in the Finder, for example, in the current user directory. You can create multiple repository directories in the SVN directory

mkdir svn
Copy the code

2. Create a code repository

Open the terminal, create a code repository, and enter the command:

svnadmin create svn/code
Copy the code

After the command is successfully executed, a SVN /code directory is found on the hard disk. The directory structure is as follows

2. Configure user rights on the SVN

Modify three files in the/SVN /code/conf directory

1. Configure read and write permissions

In a text editor, open SVNserve.conf and remove the # and Spaces before the following configuration items

# anon-access = read
# auth-access = write
# password-db = passwd
# authz-db = authz
Copy the code

  • Anon-access = read indicates that anonymous access is read-only
  • Change to anon-access = None to disable anonymous access and require a password for access

2. Add a user

Open passwd and add the user and password under [users]. The left side of the equals sign is the user name and the right side is the password. If you want to add a new user, start another line [users] MGR = 123 user1 = user1 user2 = user2 user3 = user3

3. Configure user groups and permissions

Turn on AuthZ and assign users added in passwd to different user groups to manage permissions.

3.1 grouping

[groups] super= MGR user = user1,user2 [groups] super= MGR user = user1,user2

3.2 Group Permission Configuration.

Use [/] to represent all resource libraries on the SVN server

[/]
@super = rw
Copy the code

The above configuration indicates that all users in the super group have read and write (RW) permissions on all resource libraries. The group name must be preceded by @

[/] user3 = rw If you need to specify the resource permission in the root directory, for example, if there is a lib folder in the root directory, [/lib] @user = rw Indicates that you have the read and write permission on the user group in the lib folder

In the following figure, I did not delete the default sample

4. Start the SVN server

  • Get the path of your SVN first, if you follow the steps above to create the directory should be /Users/ your computer user name/SVN
  • Enter the following command on the terminal: SVNserve-d-r /Users/ The user name of your computer/SVN

Alternatively, enter svnserve -d -r /Users/ User name of your computer/SVN /code. If no prompt is displayed, the startup is successful. You can also view the activity Monitor in the MAC utility

  • To exit, double-click in the activity monitor and select Exit.

Configuration Cornerstone

1. Connect to the SVN server

Start the SVN

  • Enter the following command on the terminal: SVNserve-d-r /Users/ The user name of your computer/SVN

  • Open Cornerstone and click Add Repository

  • Select SVN Server and fill in “Server” : localhost if the server is local and write its IP address on other computers on the LAN. For example, I created the code base in the root directory of the SVN above, so directly fill in the code name and password to Add the user name and password you want to log in. Finally, click Add. If the connection is successful, it will show succeeded and the connection is complete

2. Store the code in the SVN

1. In the library, create a new folder and right-click in the corner of the cornersotone. The following information will appear: