How to build a local svn server and manage local code

Source: Internet
Author: User
Tags tortoisesvn

The following describes how to build a local svn server.

I. Preparations

1. Download the svn server: Subversion.
Go to the official website (http: // s to download the latest Server Installation program. The latest version is 1.8.9. Note: Do not download the source code. There is no bin folder in the source code. The source code needs to be compiled in unix, linux, cygwin, and other environments, which is related to another topic. To simplify the installation, download the installation version directly. 2. Obtain the client program: TortoiseSVN
Obtain the latest tortoisesvnfrom the official website TortoiseSVN is a client program used to communicate with the Subversion server. Subversioncomes with a client-End program svn.exe, but TortoiseSVN provides better operations and improves efficiency.

Ii. Install the server and client

To build the svn service, install the server and client. Install the Subversion (SVN) server and client. The downloaded Server is a zip package, which can be directly decompressed. For example, I can decompress the package to E: \ subversion. The Client installation file is an exe executable file, which can be directly run and installed as prompted.

3. Create a version Library (Repository)

To run the Subversion server, you must first create a version Library (Repository ). The version library can be seen as a place where data is centrally stored and managed on servers. Create a version library. First, create an empty e: \ svn folder as the root directory of all version libraries. Then, go to the command line and switch to the bin directory of s version. Enter the following command: svnadmin create E: \ svn \ repos1. This command creates a version library repos1 under E: \ svn. Some folders and files are automatically generated under repos1.
4. Run an independent server

When constructing the svn service, you must run an independent server. At this time, the Subversion service has not started yet, but the version library has been created through its command. Enter svnserve -- daemon in the Command window.

Svnserve will wait for the request on port 3690, and the -- daemon (two dashes) Option tells svnserve to run in daemon mode, so that it will not return before manual termination.

Do not close the command line window. Close the window will stop svnserve.

To verify that svnserve works properly, use TortoiseSVN-> Repo-browser to view the version library. In the pop-up URL dialog box, enter: svn: // localhost/svn/repos1

Click "OK" to view the directory tree structure of the repos1 version library, but repos1 is an empty database.

5. Configure users and permissions

Open the E: \ svn \ repos1 \ conf directory in a text editor,
Modify svnserve. conf:Change: # password-db = passwd to: password-db = passwd

Remove the # annotator. Note that there is no space before it.

ThenModify the passwd file in the same directoryTo add an account:

# Harry = harryssecret
# Sally = sallyssecret
Add an account:
# Harry = harryssecret
# Sally = sallyssecret
Test = test

Vi. initialize Import

The following describes how to import data (projects) to this version library when constructing the svn service, and then the version library will manage our data. Any changes made to us are recorded by the version library. Even if we lose or correct the data, the version library can help us retrieve the data.

For example, I have a gstbook folder under d: \ wwwroot, which stores the message book program I wrote.

In this folder, right-click "-> TortoiseSVN-> Import..." And enter "svn: // localhost/repos1/gstbook" in "URLofrepository" in the pop-up dialog box ". In Importmessage, enter "import entire message book" as the comment.

After clicking OK, enter the account. Enter test in both the user name and password. After completion, all the content in the gstbook is imported to svn: // localhost/svn/repos1/gstbook.

We can see that there is no change in e: \ svn \ repos1, and even a ststbook folder is not created. The only change is that the capacity of e: \ svn \ repos1 has increased. In fact, the content in the source gstbook has been imported into the repos1 version library, and the source gstbook folder can be deleted.

Note that this step can be performed on another client with TortoiseSVN installed. For example, if the IP address of the host running svnserve is, the content entered in the URL section is "svn: // ".

VII. Basic operation procedure

1. checkout)

Extract the version library to a working copy:
To any empty directory, such as creating an empty folder f: \ work in partition f. Right click-> SVNCheckout ". Input "svn: // localhost/svn/repos1/gstbook" in "URLofrepository", so that we can get a copy of the content in the gstbook.
2. Deposit (checkin)/submit (commit)
Make changes in the work copy and submit:
Open a file and modify it in the working copy of The gstbook. Right-click the file and choose "SVNCommit ...". In this way, the modifications are submitted to the version library, which stores the submitted data as needed.
Right-click the modified file and choose TortoiseSVN> ShowLog to view all submissions to the file. Right-click "Comparewithworkingcopy" on different revision entries to compare the differences between the files with the selected revision version.

This section describes how to complete the SVN service.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.