Home  >  Article  >  Backend Development  >  Getting started with SVN and configuring it_PHP tutorial

Getting started with SVN and configuring it_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:39:451039browse

SVN, or Subversion, is a free and open source version control system that can restore data to earlier versions or check the history of data modifications. The data can be source code or other types of files.

Before the emergence of SVN, CVS was the de facto standard for version control tools in the open source world. However, CVS had some inherent flaws, and fixing these flaws required a lot of effort. Therefore, Brian Behlendorf, the initiator of SVN, and CollabNet decided to re- Write a version control system that retains the basic ideas of CVS, but corrects its errors and unreasonable features. As a result, SVN emerged as the successor of CVS. The designers of SVN strive to win the favor of CVS users through two efforts: keeping the design and interface style of the open source system as similar as possible to CVS, while trying to make up for the many obvious shortcomings of CVS. The result of these efforts is that migrating from CVS to SVN does not require major changes, so more and more people choose SVN.
http://svnbook.red-bean.com
http://www.subversion.org.cn

Table of contents

1. Use of client
1.1 General use under Linux system (Ubuntu)
1.2 General use under Windows system
1.3 Use SVN+ssh authentication under Linux (no relevant information found @_@)
1.4 Using SVN+ssh authentication under Windows
2. Server-side configuration
2.1 svnserve configuration under Linux
2.2 svnserve configuration under Windows
2.3 svnserve+ssh configuration under Linux
2.4 svnserve+ssh configuration under Windows (requires Cygwin, omitted)
2.5 APache-based SVN server configuration under Linux
2.6 APache-based SVN server configuration under Windows
3. Establish a version library
3.1 Create a version library under Linux
3.2 Create a version library under Windows

Most people start using SVN from the client. The following will introduce the use of the client first. Assume that the SVN server has been assumed, its folder address is http://domain/svn/trunk/myproject, the user name is test, and the password is test. (If the server is configured with SVN, use the URL starting with svn:// for access; if the server is configured with SVN+SSH, use the URL starting with svn+ssh for access)

1. Use of client

1.1 Generally used under Linux (Ubuntu) system

1) First, you need to install the svn client. Under ubuntu, use $sudo apt-get install subversion (for others, please baigoogledu, Yu Tong)

2) checkout command: Use the checkout command when using it for the first time to copy the server directory to the current local directory. At the same time, a hidden folder will be created to record version information:
[Working directory]$svn checkout "http://domain/svn/trunk/myproject" --username test
Then enter the password

3) svn update command: Get the latest version on the server
[Working Directory]$svn update (except for the first time you need to add the url, user name and password, the system will remember it later)

4) svn add command: To add non-versioned local files to version control:
​[Working directory]$svn add hello.c

5) svn commit command: upload local files to the server

[Working directory]$svn commit (if there are new files, svn add first)

1.2 General use under Windows system

1) Install the client: http://tortoisesvn.net/downloads

2) Create a new folder (working directory), right-click and select checkout, fill in the URL and username and password

3) Right click on the working directory to update

4) Right click on the working directory to add

5) Right click on the working directory and commit

1.3 Using SVN+ssh authentication under Linux(No relevant information found@_@)

1.4 Using SVN+ssh authentication under Windows

(Refer to setting up svn server under ubuntu and establishing svn+ssh client in windows)

1.4.0 Install TortoiseSVN, Puttygen, Pageant
​http://sourceforge.net/projects/tortoisesvn
​http://www.chiark.greenend.org.uk/~sgtatham/putty/

1.4.1 Convert private key format
1) Copy the file key under Linux to Windows and run Puttygen;
2) Select the menu conversions->Import Key; select the file key, prompt "Enter passphrase for key", enter the passphrase keyword used to create the public-private key pair;
3) Select Parameters as "SSH-2 DSA" or "SSH-2 RSA" ->Save private key->Save the file name as username>key.ppk.

1.4.2 Establish the association between TortoiseSVN and Pageant, and add the private key to Pageant:
1) Right-click the mouse and select TortoiseSVN->Settings->Network->SSH client, enter:
C:Program FilesTortoiseSVN inTortoisePlink.exe
2) Right-click the mouse and select TortoiseSVN->RepoBrowser Enter URL:
​svn+ssh://@/usr/local/svn/trunk
3) Run Pageant, right-click the icon in the lower right corner of the screen -> Add Key, and add the private key file key.ppk.
——If you don’t want to cache the ssh password, steps 8 and 9 are not required and only the second step will be retained. However, you will have to enter the password twice every time you check out or check in every time you enter a folder, which will bore you to death :)

2. Server-side configuration

There are three options for web server deployment, and the configurations are arranged from simple to complex

·svnserve

·svnserve over SSH

·Apache+mod_dav_svn module

Let’s start with the simplest one and introduce svnserve.

[Update] The server-side configuration under Windows can use VisualSVN Server for fool-proof installation.

Official website: http://www.visualsvn.com/

Reference link: Introduction to VisualSVN series (there is a detailed introduction to the installation process, which will not be reproduced here)

2.1&2.2 Configure svnserve

svnserve is a lightweight server that can communicate with clients through a custom stateful protocol based on TCP/IP. The client uses a URL starting with svn:// or svn+ssh://svnserve. Access an svnserve server.

2.1 svnserve configuration under Linux

2.1.0 Similarly, use the command $sudo apt-get install subversion

2.1.1 svnserve acts as an independent daemon and listens for requests
​$svnserve -d
​$ #svnserve is now running, listening on port 3690
——You can use --listen-port=[port number] to specify the port, or --listen-host=[host name] to specify the host name
Assume that a repository has been created and is located in the /usr/local/repositories/project path (the establishment of the repository will be mentioned later). At this time, the client can use svn://[host]/usr/local/repositories/project to proceed. Visit
——You can use the -r option to limit the output to only the repository under the specified path, thereby making client access more concise:
​$svnserve -d -r /usr/local/repositories
Then the client can access

as long as it uses svn://[host]/project

2.1.2 Using svnserve with inetd
​$svnserve -i
——At this time, svnserve will try to use a custom protocol to talk to the subversion client through stdin and stdout. The default port is 3690. You can add the following lines to /etc/services:
​svn 3690/tcp #subversion
​svn 3690/udp #subversion
——If you are using the classic Unix-like inetd daemon, you can add the following line to /etc/inetd.conf. Then if a customer connects to port 3690, inetd will generate an svnserve process to provide services
​svn stream tcp nowait svnowner /usr/bin/svnserve svnserve -i

2.1.3 Set up svnserve’s built-in authentication

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486270.htmlTechArticleSVN, or Subversion, is a free and open source version control system that can restore data to earlier versions, or check History of data modifications. This data can be source code or...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn