Set up SVN service in Windows

Source: Internet
Author: User
Tags tortoisesvn

I. Preparations

1. Obtain the Subversion server program

Download the latest server installer from the official website (http://subversion.tigris.org. Currently the latest version is 1.5, specific in: http://sourceforge.net/projects/win32svn? Source = DLP

2. Obtain the tortoisesvn client program

Get the latest tortoisesvn from the official website http://tortoisesvn.net/downloads. Tortoisesvn is a client program used to communicate with the subvers server. Subversion comes with a client program svn.exe, but tortoisesvn provides better operations and improves efficiency.

Ii. Install the server and client

Install the subversion (SVN) server and client. The downloaded Server is a zip package, which can be decompressed directly. For example, I can decompress the package to E: \ subversion. If you download an MSI file, install it directly. The Client installation file is an EXE executable file. You can directly run the file and follow the prompts to install it. After the Client installation is complete, the system prompts you to restart.

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. Or run the CMD command mkdir E: \ SVN.
Then, go to the command line and switch to the bin directory of subversion. Run 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.

We can also use tortoisesvn to perform this step graphically:

First, create an empty directory e: \ SVN \ repos1. Note that it must be empty. In the repos1 folder, right-click and choose tortoisesvn> Create repository here... ", then you can select the version library mode. Here you can use the default fsfs, and then create a series of folders and files, which are the same as those created on the command line.

4. 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 the following in the Command window:

Svnserve.exe -- daemon
Note: When starting, you may be prompted that the libapr_tsvn32.dll file is missing and can be found online. Subversion1.8.0. libapr_tsvn32.dll is 1.4.6. No problems have been found yet. If the DLL corresponding to the Subversion cannot be found, use another version instead.

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 exit 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
(Localhost can also be an IP address. Do not change the two slashes before localhost to one)

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

You can also use the -- root option to set the root location to restrict the access directory of the server, so as to increase security and save time for inputting the svnserve URL:

Svnserve.exe -- daemon -- root drive: \ path \ To \ Repository

In the previous test, svnserve runs as follows:

Svnserve.exe -- daemon -- root E: \ SVN

Then the browser URL in tortoisesvn is reduced:

SVN: // localhost/repos1

You may ask, isn't it necessary to input a command every time you start the svn server? How can I enable the svn server to automatically start when it is started? The answer is to register the svn service to a Windows system service and execute the command at a Windows command prompt.

SC create SVN binpath = "\" D: \ subversion \ bin \ svnserve.exe \ "-- service-R F: \ SVN" displayname = "SVN service" depend = TCPIP start = auto, is this command a little long.

(Note that there is a space behind the equal sign. Do not forget it. If it is missing, the registration service may fail or a bunch of registration options will pop up. You can also remove-r f: \ SVN)

In fact, it is easy to understand that SC is a built-in system service registration tool for Windows. The Microsoft support center provides a detailed description. I will not repeat it here. The parameter binpath = "\" D: \ subversion \ bin \ svnserve.exe \ "-- service-r f: \ SVN" is similar to the Command Used to manually start the svn server? I just changed-D to -- service, which is not hard to understand, because it is a service now. Okay, now it's done. Please try again.

PS: If you want to delete the svn service you just registered from the system service, you can use the SC delete SVN command.

5. Configure users and permissions

Open the E: \ SVN \ repos1 \ conf directory in the text editor and modify svnserve. conf:

Set:

# Password-DB = passwd

Changed:

Password-DB = passwd

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

Then modify the passwd file in the same directory and add an account:

Set:

[Users]
# Harry = harryssecret
# Sally = sallyssecret

Add an account:

[Users]
# Harry = harryssecret
# Sally = sallyssecret
Test = test

Vi. initialize Import

The following describes how to import our data (project) to this version library and manage our data in the future. Any of our changes 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 guestbook folder under D: \ wwwroot, which stores the message book program I wrote. In this folder, right-click "-> tortoisesvn-> Import..." And enter "SVN: // localhost/repos1/Guestbook" in "URL of repository" in the pop-up dialog box ". In "Import message", 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 content in the guestbook is imported to SVN: // localhost/SVN/repos1/guestbook.

We can see that there is no change in E: \ SVN \ repos1, and even a guestbook folder is not created. The only change is that the capacity of E: \ SVN \ repos1 has increased. In fact, the content in the source guestbook has already been imported into the repos1 version library, and the source guestbook 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 133.96.121.22, the content entered in the URL section is "SVN: // 133.96.121.22 ".

VII. Basic operation procedure

1. Check out)

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 and choose SVN checkout ". In "URL of repository", enter "SVN: // localhost/SVN/repos1/Guestbook" to get a copy of the content in the guestbook.

2. Check in/commit)

Make changes in the work copy and submit:

In the copy of the guestbook job, open a file and modify it. Right-click and choose SVN commit ...". 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> show log to view all submissions to the file. Right-click different revision entries and choose "compare with working copy". We can compare the differences between the files that work copies and the selected revision version.

Related Article

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: info-contact@alibabacloud.com 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.