Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure the SVN server

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to configure the SVN server, which is very detailed and has certain reference value. Friends who are interested must finish reading it!

Create an autoRunSVN.bat file with the following contents:

Cpp code

Sc create MySVNServer binpath= "\" C:\ Program Files\ Subversion\ svnserve\ svnserve\ "--service-r H:\ homerepos" displayname= "SVNService" depend= Tcpip start= auto

Pause

Sc create MySVNServer binpath= "\" J:\ java\ Subversion\ bin\ svnserve.exe "- service-r\" G:\ svn repository\ "" displayname= "SVNService" depend= Tcpip start= auto

Pause

Note:

(1) sc is the service configuration program that comes with windows, and MySVNServer is the name of the service, which seems to be useless.

(2) the parameter binPath indicates the installation path of the svnserve executable file. Because the "Program Files" in the path has a space, the whole path needs to be enclosed in double quotation marks. The double quotation mark itself is a special character and needs to be escaped, so both double quotes before and after the path need to be written as\ ".

(3)-- the service parameter indicates that it runs as a windows service,-- r indicates the location of the svn repository, and both the service parameter and the r parameter are part of the binPath, so they are enclosed in a pair of double quotes along with the path of the svnserve.exe, which do not need to be escaped.

(4) displayname represents the name displayed in the list of windows services. Depend = Tcpip means that the svnserve service needs tcpip service to run, and start=auto means to run automatically after booting. After installing the service, svnserve will not run automatically until the next time it is powered on. (5) there is no space before the equal sign of binPath, and so is the space after the equal sign of displayname depend start.

The front of service is-- not -, and the front of r is-

(6) to uninstall the svn service, execute sc delete svnserve.

(7) from "sc" to "auto" is in the same command sc and must be written on the same line.

After the creation is successful, you can type service.msc to view the system service, find the SVNService entry, view the properties of the service, and use the interface provided by Windows to operate the SVNService service.

P.S. Through my experiments, the above SVN boot self-startup method has been unable to achieve, because can not write batch statements, I do not know what is wrong, but many places on the Internet are using this method to achieve boot self-startup. Finally, we can only find a new method. Although it can not boot itself, it is more convenient to implement multiple service processes and manage multiple folders. Please make your own choice.

Create a SVNService.bat file with the following contents (respect the author's copyright, do not delete the author's information):

@ ECHO OFF

:: =

: author: Zealic

Version: 1.05

Function: install Subversion in a simple and quick way.

Last Updated: 2007-12-28

:: =

Initialize the environment

:: =

ECHO * install Subversion service *

:: =

:: =

:: create a service

:: =

ECHO + create repository service +

ECHO creates a system service, which requires some information to be entered.

: INPUT_SVC_NAME

SET / P svc_name= Please enter the service name:

:: service name cannot be empty

If "% svc_name%" = "" (

The ECHO service name cannot be empty. Please enter it again.

GOTO INPUT_SVC_NAME

)

:: query whether the service exists. By looking for errors in the output, "1060:" is the error code output when an error occurs.

SC QUERY "% svc_name%" | find "1060:" > > NUL

IF% errorlevel% = = 1

The ECHO service'% svc_name% 'already exists! Please re-enter the service name.

GOTO INPUT_SVC_NAME

)

ECHO.

:: enter resource library information

: INPUT_REPOS

SET / P repos= Please enter the repository path:

ECHO.

:: create a service

ECHO you create a Subversion service with the following information:

ECHO service name: "% svc_name%"

ECHO repository path: "% repos%"

ECHO is creating a service.

SC create% svc_name% binPath= "\" E:\ Subversion\ bin\ svnserve.exe\ "- service-r\"% repos%\ "" depend= Tcpip start= auto | find "1060:" > > NUL

ECHO.

IF% errorlevel% = = 0 GOTO SC_ERROR

ECHO-create service successfully!

ECHO.

ECHO.

:: =

:: generate operation batch file

:: =

ECHO + generate service operation batch +

The ECHO service operation batch file can help you manipulate the service quickly.

SET bat_delete=DELETE_%svc_name%.BAT

SET bat_start=START_%svc_name%.BAT

SET bat_stop=STOP_%svc_name%.BAT

ECHO generated delete service batch'% bat_delete% '...

:: bat_delete

ECHO @ ECHO OFF > bat_delete%

ECHO NET STOP svc_name% > > bat_delete%

ECHO SC delete% svc_name% > > bat_delete%

ECHO DEL bat_start% > > bat_delete%

ECHO DEL bat_stop% > > bat_delete%

ECHO DEL bat_delete% > > bat_delete%

ECHO PAUSE > > bat_delete%

:: bat_start

ECHO build runs the service batch'% bat_start% '...

ECHO @ ECHO OFF > bat_start%

ECHO NET START svc_name% > > bat_start%

ECHO PAUSE > > bat_start%

:: bat_stop

ECHO build stop service batch'% bat_stop% '...

ECHO @ ECHO OFF > bat_stop%

ECHO NET STOP svc_name% > > bat_stop%

ECHO PAUSE > > bat_stop%

ECHO.

ECHO-generate service operation batch processing successful!

ECHO.

ECHO.

:: =

:: Finish

:: =

ECHO # all operations succeeded! #

GOTO END

:: =

:: error segment

:: =

: ENV_ERROR

ECHO-failed to set environment variable!-

GOTO END

: SC_ERROR

ECHO-failed to create service!

GOTO END

: SC_INV_PORT

Invalid port number for ECHO. Please re-enter it.

GOTO INPUT_SVC_PORT

: END

PAUSE

Where SC create% svc_name% binPath= "\" E:\ Subversion\ bin\ svnserve.exe\ "- service-r\"% repos%\ "" depend= Tcpip start= auto | find "1060:" > > NUL needs to change binpath to the path where svnserve.exe is located, and then you can run the service.

5. Configure users and permissions

Open the E:\ svn\ repos1\ conf directory with a text editor and modify the svnserve.conf:

Will:

# password-db = passwd

Change to:

Password-db = passwd

That is, remove the preceding # comment character and note that there can be no spaces in front of it.

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

Will:

[users]

# harry = harryssecret

# sally = sallyssecret

Increase account number:

[users]

# harry = harryssecret

# sally = sallyssecret

Test = test

VI. Initialize import

The following is to import our data (project) into this version library, which will manage our data later. Any changes we make will be recorded by the version library, which can help us retrieve data even when we lose or correct our own data.

For example, I have a guestbook folder under d:\ wwwroot that contains the guestbook programs I wrote. Click "right-> TortoiseSVN-> Import..." on this folder, and enter "svn://localhost/repos1/guestbook" in the "URL of repository" of the pop-up dialog box. Enter "Import entire guestbook" in "Import message" as a comment.

You are required to enter an account number after clicking OK. We enter test in both the user name and password. After completion, all the contents of the guestbook are imported into svn://localhost/svn/repos1/guestbook.

We see no change in e:\ svn\ repos1, not even a guestbook folder has been established, the only change is that the capacity of e:\ svn\ repos1 has become larger. In fact, the contents of our source guestbook have been imported into the repos1 version library, and the source guestbook folder can be deleted.

It is important to note that this step can be done entirely on another client with TortoiseSVN installed. For example, if the IP of the host running svnserve is 133.96.121.22, the input in the URL section is "svn://133.96.121.22".

VII. basic operation flow

1. Take out (check out)

Take out the version library to a working copy:

Go to any empty directory, such as creating an empty folder f:\ work in the f partition. "right-> SVN Checkout". Type "svn://localhost/svn/repos1/guestbook" in "URL of repository" so that we get a working copy of the content in guestbook.

2. Deposit (check in) / submit (commit)

Make changes in the working copy and submit:

Open any file in the guestbook working copy, make changes, and then "right-> SVN Commit...". In this way, we submit the changes to the version library, which stores the data we submitted as appropriate.

On the modified file, "right-click-> TortoiseSVN-> Show Log", you can see all the submissions for this file. By clicking "right-> Compare with working copy" on different revision entries, we can compare the difference between the working copy of the file and the selected revision version.

The above is all the contents of the article "how to configure the SVN Server". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report