Install svn and configure CentOS5.5 and ubuntu14.14
1. environment centos5.5 2. install svn yum-y install subversion 3. configure the version library directory mkdir/www/svndata svnserve-d-r/www/svndata 4. create a version library and create a new Subversion project svnadmin create/www/svndata/oplinux configuration that allows rsync to access cd/www/svndata/oplinux/conf vi svnserve. confanon-access = noneauth-access = writepassword-db = passwd Note: there must be no space before the modified file, otherwise, an error occurred while starting svn server vi passwd [users] # <user 1 >=< password 1 >#< user 2 >=< password 2> david = 1234565. client Connection svn co svn: // ip/oplinu X username and password: 123456 ============================================== =====================================6. to achieve SVN and WEB synchronization, You can CO it out or directly configure it in the repository. 1) set the root directory of the WEB server to/www/webroot. 2) checkout a copy of SVN svn co svn: // localhost/oplinux/www/webroot modify the permission to the WEB user chown-R apache: apache/www/webroot/oplinux 3) create synchronization script cd/www/svndata/oplinux/hooks/cp post-commit.tmpl post-commit edit post-commit, add the following content at the end of the file: export LANG = en_US.UTF-8SVN =/usr/bin/svnWEB =/www/we Broot/$ SVN update $ WEB-username rsync-password rsyncchown-R apache: apache $ WEB adds the script execution permission chmod + x post-commit submit -- install svn sudo apt-get install subversion-tools 1. Check out svn co http: // path (full directory or file path) [full local directory path] -- username -- password svn co svn: // path (directory or file Full path) [local directory full path] -- username -- password svn checkout http: // path (full path of directory or file) [full local directory path] -- username svn checkout svn: // path (full directory or file path) [full local directory path] -- username note: if the -- password parameter is not included, the system will prompt you to enter the password. We recommend that you do not use the -- password option in plain text. Username and password are two short-term, not one. If the full path of the local directory is not specified, the local directory is checked out. Example: svn co svn: // 192.168.0.3/test tool/home/testtools -- username wzhnscsvn co http: // 192.168.0.3/test/testapp -- username wzhnscsvn checkout svn: // 192.168.0.3/test tool/home/testtools -- username wzhnscsvn checkouthttp: // 192.168.0.3/test/testapp -- username wzhnsc 2. Export (export a clean file without any. svn folder directory tree) svn export [-r version] http: // path (full directory or file path) [full local directory path] -- username svn export [-r version number] svn: // path (full directory or file path) [full local directory path] -- use Rname username svn export detected locally (. svn folder) Directory full path local directory full path to export note: the first way to export a clean working directory tree from the version library is to specify the URL, if the revision version number is specified, the corresponding version is exported. If no version is specified, the latest version is exported to the specified location. If the full path of the local directory is omitted, the last part of the URL is used as the name of the local directory. The second method is to specify the full path of the local directory to be exported. All local modifications will be retained, but not under Version Control (that is, new files not submitted, because. files in the svn folder that do not have relevant information records will not be copied. Example: svn exportsvn: // 192.168.0.3/test tool/home/testtools -- username wzhnscsvn exporthttp: // 192.168.0.3/test/testapp -- username wzhnscsvn export/home/testapp/home/testtools 3. add a new file svn add file name. Note: The SVN server is told to add files, you also need to use svn commint-m to upload it! Example: svn add test. php <-add test. phpsvn commit-m "add my test with test. php "test. phpsvn add *. php <-add all the php files under the current directory svn commit-m "add my test with all php files" *. php 4. Submit svn commit-m "submit remarks text" [-N] [-- no-unlock] File Name svn ci-m "submit remarks text" [-N] [-- no-unlock] The-m parameter must be included in the file name, the parameter can be null, but the-m example must be written: svn commit-m "submit all files in the current directory under Version Control" * <-note this * indicates all files svn commit-m "submit my test. php "test. phpsvn commit-m "submit my test with test. php "-N -- no-un Lock test. php <-keep the lock and use-no-unlock to switch svn ci-m "submit all files in the current directory under Version Control" * <-note this * indicates all files svn ci-m "submit my test. php "test. phpsvn ci-m "submit my test with test. php "-N -- no-unlock test. php <-use-no-unlock to keep the lock. 5. update the svn updatesvn update-r file. svn update file name. Example: svn update <-there is no directory at the end, by default, all files in the current directory and subdirectory are updated to the latest svn update-r 200 test. cpp <-run the test. cpp is restored to the revised version (revision) 200svn update test. php <-updates and version libraries are synchronized. An expiration conflict is prompted during submission. You need to update and modify the file, clear svn resolved, and submit commit. 6. delete the file svn delete svn: // path (full directory or file path)-m "delete remarks text" is recommended as follows: svn delete file name svn ci-m "delete remarks text" Example: svn delete svn: // 192.168.1.1/testapp/test. php-m "deletes the test file. the following operations are recommended for php: svn delete test. php svn ci-m "Delete the test file. php "7. lock/unlock svn lock-m" lock remarks text "[-- force] File Name svn unlock file name example: svn lock-m" lock test. PHP file "test. php svn unlock test. php 8. Differences: svn diff file name svn diff-r corrected version number m: Corrected version number n file name example: svn diff te St. php <-compare the modified file with the basic version svn diff-r 200:201 test. php <-differences between version 200 and version 201 9. Check the svn st directory path/name svn status directory/name <-files and subdirectories in the directory status, normal status does not show 【?: 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: locked: svn-v directory path/name svn status-v directory path/name <-displays the file and subdirectory status. The first column remains the same, and the second column displays the working version number, the third and fourth columns show the last modified version number and modifier. Note: The svn status, svn diff, and svn revert commands can also be executed without a network, the reason is that svn is local. svn retains the original copy of the local version. 10. view the svn log file name example: svn log test. php <-display all modification records of this file, and changes to its version number. 11. View Details of the file. svn info file name example: svn info test. php 12. SVN help svn help <-all functional options svn help ci <-description of specific functions 13. view the files and directories in the repository svn list svn: // path (full directory or file path) svn ls svn: // path (full directory or file path) Example: svn list svn: // 192.168.0.3/testsvn ls svn: // 192.168.0.3/test <-display svn: // all files and directories belonging to the version library under the 192.168.0.3/test directory 14. Create the svn mkdir directory name svn mkdir-m under version control. "add directory remarks text" http: // Example of directory full path: svn mkdir newdirsvn mkdir-m "Making a new dir. "http: // 192.168.0.3/test/newdir Note: After adding sub-directories, you must go back to the root directory to update them, otherwise, the system will prompt "failed to submit" svn update when submitting files in this directory. Note: If you create a new folder newsubdir in the directory that comes out of checkout, run the svn mkdir newsubdir command again, SVN will prompt: svn: Try to replace "svn add" or "svn add -- non-recursive? Svn: the directory "hello" cannot be created. If the file already exists, run the following command: svn add -- non-recursive newsubdir to enter the newsubdir folder, if you use ls-a to view all the directories and files under it, you will find more :. svn directory and then svn mkdir-m "add hello function module File" svn: // 192.168.0.3/test/newdir/newsubdir command, SVN prompt: svn: File already exists: filesystem '/data/svnroot/test/db', transaction '2017-1', path'/newdir/newsubdir' 15. Restore local svn revert modification [-- recursive] file name. Note: the sub-commands do not access the network and will dissolve the conflict. However, it does not restore the deleted directory. Example: svn revert foo. c <-discard the svn revert -- recursive modification to a file. <-restore an entire directory file ,. for the current directory 16, update the work copy to another URL svn switch http: // directory full path local directory full path example: svn switch http: // 192.163.0.3/test/456. <-(original 123 Branch) the current directory branch is located at 192.163.0.3/test/456 17. resolve the conflict svn resolved [local directory full path] example: $ svn updateC foo. cUpdated to revision 31. if you get a conflict during the update, your work copy will generate three new files: $ lsfoo. cfoo. c. minefoo. c. r30foo. c. r31 when you solve foo. c conflicts, prepare for submission, and run svn resolved to copy your work You know that you have done everything. You can only delete and submit conflicting files. However, in addition to deleting conflicting files, svn resolved also fixes record data in the work copy management area. Therefore, we recommend that you use this command. 18. Check the full path of svn cat http: // file without checkout. Example: svn cat http: // 192.168.0.3/test/readme.txt