Linux SVN build and Sync

Source: Internet
Author: User

Installation:
Yum Install Subversion

Verify:
Svnserve--version

Code base creation: (Similarly, multiple warehouses can be built) [repo]
Mkdir-p Absolute Path
Svnadmin Create absolute path/warehouse name
As
Mkdir-p/opt/svn/repositories
Svnadmin create/opt/svn/repositories
After executing the above command, the repositories library is created automatically,
View/opt/svn/repositories folder discovery contains Conf, db,format,hooks, locks, README.txt, etc.
File stating that an SVN repository has been established.


To configure the code base:
Go to the folder created above conf, configure
CD Absolute Path/conf
As
Cd/opt/svn/repositories/conf

User Password passwd configuration:
[Email protected] password]# cd/opt/svn/repositories/conf
[Email protected] conf]# vim passwd
[Users]
# Harry = Harryssecret
# sally = Sallyssecret
#增加对, User name = password
#as:
lin3615=lin3615
Fuck=fuck

Permissions Control Authz Configuration:
[Email protected] conf]# vim Authz
#设置 [/] represents all resources in the root directory
[/]
#用户名 = permissions As
Lin3615=rw
Fuck=rw
Service svnserve.conf Configuration:
[[email protected] conf]# vim/absolute path/svnserve.conf
[General]
#匿名访问的权限, can be read,write,none, default is read
Anon-access=none
#使授权用户有写权限
Auth-access=write
#密码数据库的路径
password-db=passwd
#访问控制文件
Authz-db=authz
#认证命名空间, Subversion is displayed in the authentication prompt and is used as a keyword in the credential cache
# realm=/Warehouse Absolute path/warehouse name
#as:
Realm=/opt/svn/repositories

Configure Firewall ports:
[Email protected] conf]# Vim/etc/sysconfig/iptables
Add the following content:
-A input-m state--state new-m tcp-p TCP--dport 3690-j ACCEPT
Restart firewall after saving
[Email protected] conf]# service iptables restart

Start SVN:
#svnserve-D-r/absolute path/warehouse name [--listen-port Port number]
#as:
svnserve-d-r/opt/svn/repositories--listen-port 3690
Similarly, you can start multiple specified warehouses, as long as the ports are different

To view the SVN process:
[Email protected] conf]# Ps-ef|grep svn|grep-v grep

To stop restarting SVN:
[[email protected] password]# killall svnserve//Stop
Start:
# svnserve-d-R/absolute path/warehouse name
#as:
[[email protected] password]# svnserve-d-r/opt/svn/repositories//start

Test: (Can import project from here, method one)
Client Connection Address: SVN://IP: Port number
Username/password: lin3615/lin3615

If the connection fails, the
Shutting down the firewall
1) temporary entry into force, recovery after restart
Open: Service iptables start
Close: Service iptables stop
2) Permanent, no recovery after reboot
Open: Chkconfig iptables on
OFF: Chkconfig iptables off

Method two Import Project: (Import from the SVN server itself, that is, the other files [folder] into the SVN repository)
SVN Import Project Absolute path svn://ip[: Port number]-m "comment"
As
SVN import/var/www/html/test svn://192.168.0.8:3690-m "Import from Catalog test to SVN repository"

Export the SVN warehouse project to the specified directory
SVN co SVN://IP/absolute path/directory/
As
SVN Co svn://192.168.0.8:3690/var/www/html/test/

SVN repository is synchronized with the specified directory (e.g. web directory)
Open the Hooks directory in the warehouse directory to establish the Post-commit:
As
Open/opt/svn/repositories/hooks under the Post-commit, that is, to create such a file
Join
#!/bin/sh
Cd/var/www/html/test #要与同步的目录绝对路径
/USR/BIN/SVN Cleanup # svn path
/USR/BIN/SVN up/var/www/html/test--username "username"--password "password"
#用户和密码是在 passwd The specified
If: Post-commit error code 255, should be Post-commit script permission is not right, give 777 permissions can

If you upload your code locally, a similar
Svn:can ' t convert string from ' UTF-8 ' to native encoding:
SVN:? \230?\150?\176?\229?\187?\186?\\163.txt
svn:working copy '/var/www/html/test ' Locked
Svn:run ' svn cleanup ' to remove locks (type ' svn help cleanup ' for details)

The
Export Lc_ctype= "ZH_CN. UTF-8 "
Set the variable according to your system charset if zh_cn. UTF-8 not, it is possible to change to GB2312:
It is also possible to:
Export lang= "ZH_CN. UTF-8 "

Then, to execute the SVN cleanup, first switch to the specified directory, which is the directory to be synchronized, as in/var/www/html/test
That's it.

Linux SVN build and Sync

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.