SVN uses hook implementation code to sync to web directory __web

Source: Internet
Author: User
Tags svn tortoisesvn

System environment: Windows Server 2003

Web server: IIS

The first step: SVN server Installation

Because I am using a Windows Server, I have chosen the VISUALSVN server that is most convenient to configure. Download the VISUALSVN MSI installation package on the VISUALSVN Web site and install it on the Windows Server to complete the installation.

Step Two: Firewall configuration

Open the Control Panel >windows firewall. Select exceptions to open Add port

Add the default port 3690 of the SVN service to the exception list, and click OK [next image]


Then "OK" to make the settings take effect.

Add the https/443 port to the firewall exception list with the above method because SVN has two access modes, the SVN protocol and the HTTPS protocol.

Step three: Test if the SVN service is unblocked

Here does not talk about the use of SVN and so on, do not understand their own Baidu. Open the VISUALSVN server on the "repositories" right click the new version Library test. Then right-click the new user on the users, where you can build two users, one for the server-side checkout code. Another is used on the client test. Tentative server-side user local password 123.

Client code checkout test, code checked out successfully. Add files to the directory to submit the test and commit successfully. SVN service has been successfully built.

Fourth step: Server-side Code deployment configuration

The server-side get code to the site root is implemented by triggering post-commit hooks each time the user commits the code, so write the Post-commit script that checks out the latest code in the version library to the site root. First create the directory wwwtest as the site root in a location on the server. The right to configure the directory, in order to facilitate my use of the highest permissions, for the strict external network of the Yangtze University for the development of the site root directory to set the highest permissions is harmless, until the development and then modify the corresponding permissions can be. Cut the crap. Post-commit script is as follows:

?

1 2 3 4 5 6 @ echo on set repos=%1 set user=%2 set svn= ' D:\Program files\tortoisesvn\bin\svn.exe ' set dir= ' C:\Users\rex\Desktop\test "(Call%svn% update%dir%--username local--password 123--non-interactive)

The SVN variable is the Svn.exe main program path, dir for code checkout directory (that is, after the Wwwtest site root) on the server side may not be under TORTOISESVN, but in the visualsvn of a directory, specific location to find their own. Save the script as Post-commit.bat when it is written.

Perform the first checkout command on the server-side Web site root directory [the Wwwtest directory mentioned above] using TORTOISESVN (with your own custom selection software). The following tests the correctness of the above script: first on the client through SVN upload some files to the SVN server, to the server side to execute the script file Post-commit.bat. Enter the test directory to check whether the file you just uploaded is exported to the Wwwtest directory. (PS: If you use CMD to perform post-commit.bat can see the prompt information, can be very clear to see whether the successful execution) with the script export success. The following copies the Post-commit.bat script to the server's Repositores/test/hooks folder. Restart the SVN service and update to the server from a client commit, the site root directory will be updated synchronously.

Step Fifth: Configure the IIS server to take effect on the Wwwtest Web site

Open IIS Management New Web site, the site root directory to the Wwwtest directory on the server to configure the site parameters, launch the Web site, access to test success.

Configuration complete.

Above reproduced in: http://my.oschina.net/duguying/blog/128877


Notice of the place:

On the server to install TORTOISESVN, and wwwtest site directory to checkout a copy.

If the following error occurs,

Post-commit Hook failed (exit code 1) with output:
Svn:E120171:Unable to connect to a repository at URL ' Https://xxxxx:443/svn/test '
Svn:E120171:Error running Context:an Error occurred during SSL communication

Into the tortoisesvn\bin\visual svnserver.exe note is the Apache. Feather chart that. Then modify its permission system permissions. Because the default network service does not have permission to write to.

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.