SVN Server Installation and Use in Linux and use of windows client (CentOS-6.5), svncentos-6.5

Source: Internet
Author: User
Tags svn client svn update version control system tortoisesvn

SVN Server Installation and Use in Linux and use of windows client (CentOS-6.5), svncentos-6.5
1 SVN introduction svn is short for Subversion. It is an open-source version control system. Compared with RCS and CVS, it adopts a branch management system and its design goal is to replace CVS. Many version control services on the Internet have been transferred from CVS to Subversion.
Svn servers can run in two ways: independent servers and apache. The two methods have their own advantages and disadvantages. You can choose one of them.
Svn also stores version data in two ways: BDB (a transaction-safe table type) and FSFS (a storage system that does not require a database ). Because BDB may lock data when the server is interrupted, it is safer to use FSFS.

2 SVN download Svn client and server: http://tortoisesvn.net/

3. Install SVN Server 3.1 install and configure in Linux 1) install
# Yum install-y subversion

2) Verify the installation version
# Svnserve -- version

3) Create the SVN version library. project1 is the name of the version library.
# Mkdir/data0/svn
# Svnadmin create/data0/svn/project1

4) Add a user in the format of username = Password
# Vi/data0/svn/project1/conf/passwd
[Users]
CleverCode = 123456
Test 1 = 123456
Test 2 = 123456

5) add access permissions. The CleverCode user is added to the admin group and can read and write the entire/data0/svn/project1 directory. The test1 and test2 users are added to the test group, only the/data0/svn/project1/test directory can be read and written.
# Vi/data0/svn/project1/conf/authz
[Groups]
Admin = CleverCode
Test = test1, test2

[Project1:/]
@ Admin = rw

[Project1:/test]
@ Test = rw
7) Configure svnserve. conf. There cannot be spaces at the beginning of each line in this file.
Configuration instructions:
Anon-access: controls the permissions of non-authenticated users to access the version library.
Auth-access: control the permission of the authenticated user to access the version library.
Password-db: Specifies the username and password file name.
Authz-db: Specifies the permission configuration file name, which can be used to implement path-based access control.
Realm: Specifies the authentication domain name of the version library. If the two versions of the database have the same authentication domain, we recommend that you use the same user name and password data file.


# Vi/data0/svn/project1/conf/svnserve. conf
[General]
# Anonymous access permission, which can be read, write, or none. The default value is read.
Anon-access = none
# Authenticate the user's permissions, which can be read, write, or none. The default value is write.
Auth-access = write
Password-db =/data0/svn/project1/conf/passwd
Authz-db =/data0/svn/project1/conf/authz

8) configure the firewall. svn is the port 3690.
# Vi/etc/sysconfig/iptables
-A input-p tcp-m state -- state NEW-m tcp -- dport 3690-j ACCEPT
# Service iptables restart

9) Start SVN.-d indicates running in the background.-r specifies that the root directory is/data0/svn.
# Svnserve-d-r/data0/svn

10) view SVN
# Ps-ef | grep svn

3.2 after the Windows Server is installed and configured in windows, follow the prompts and proceed to the next step. windows is relatively simple, so we will not describe it in detail.

4. Use the SVN client in the 4.1 Linux environment. 1. Run the file checkout to the local directory.
Svn checkout path (path is the directory on the server)
Example: svn checkout svn: // 192.168.1.1/pro/domain
Abbreviation: svn co

2. Add new files to the version Library
Svn add file
Example: svn add test. php (add test. php)
Svn add *. php (add all php files in the current directory)

3. Submit the modified file to the version library.
Svn commit-m "LogMessage" [-N] [-- no-unlock] PATH (if you choose to keep the lock, use the-no-unlock switch)
For example: svn commit-m "add test file for my test" test. php
Abbreviation: svn ci

4. Lock/unlock
Svn lock-m "LockMessage" [-- force] PATH
For example, svn lock-m "lock test file" test. php
Svn unlock PATH

5. Update to a specific version.
Svn update-r m path
For example:
If there is no directory after svn update, all files in the current directory and sub-directories are updated to the latest version by default.
Svn update-r 200 test. php (restore the file test. php In the version library to version 200)
Svn update test. php (updated for version library synchronization. If an expiration prompt is prompted during submission, it is because of a conflict. You need to update the file, modify the file, clear svn resolved, and then submit commit)
Abbreviation: svn up

6. view the file or directory status
1) svn status path (the State of the files and subdirectories under the directory. The normal state is not displayed)
【? : Not under svn control; M: The content is modified; C: A conflict occurs; A: It is scheduled to be added to the version Library; K: it is locked. M is usually in many States.
2) svn status-v path (displays the status of files and subdirectories)
The first column remains the same, the second column displays the working version number, and the third and fourth columns show the last modified version number and modifier.
Note: svn status, svn diff, and svn revert commands can be executed without a network, because svn is locally deployed. svn retains the original copy of the local version.
Abbreviation: svn st

7. delete an object
Svn delete path-m "delete test fle"
For example: svn delete svn: // 192.168.1.1/pro/domain/test. php-m "delete test file"
Or directly delete svn test. php and then svn ci-m 'delete test file'. We recommend that you use this
Abbreviation: svn (del, remove, rm)

8. View logs
Svn log path
For example, svn log test. php displays all the modification records of this file and changes to its version number.

9. View File details
Svn info path
Example: svn info test. php

10. Differences
Svn diff path (compare the modified file with the basic version)
Example: svn diff test. php
Svn diff-r m: n path (differences between version m and version n)
Example: svn diff-r 200:201 test. php
Abbreviation: svn di

11. Merge the differences between the two versions into the current file.
Svn merge-r m: n path
For example, svn merge-r test. php (merge the differences between version 200 and version 205 to the current file, but there are usually conflicts. You need to handle them)

12. SVN help
Svn help
Svn help ci

4.2 Use Windows environment 1) download the svn windows client from the official website and follow the instructions.
2) create a project1 file, right-click the selected file, and select SVN checkout ].


3.


 

4) enter the user and password. CleverCode: 123456.


 
5. Create a local repository

The local repository is created to solve the problem of no svn server. It is directly used locally in windows and is applicable to code Submission by a single user on the local machine. Not applicable to team development.

1) create a local repository: select a folder (such as code), = "[TortoiseSVN] =" [create repository here ].

2) view the address of the local repository: select the code directory, =, [TortoiseSVN] =, and [repo-browse ]. Local Address: file: // E:/a/code.


3) check out warehouse data: select another directory (mycode), = "[SVN checkout], and enter file: // E:/a/code in the address.



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.