first build the SVN server
1, install SVN serverInstall subversion directly with Apt-get or Yum (you can, of course, go to the official download installation yourself)
sudo apt-get install subversion
2, create a version library
svnadmin Create/home/myreposThe file directories here are set by themselves.
3, configuration SvnserveWhen the above repository/home/myrepos is established, the Conf folder will be generated under the folder and the following 3 files will be entered under/home/myrepos/conf.
Authz passwd svnserve.confWe modify 3.1,svnserve.conf in turn to modify the following sections:
- Authz-db = Authz
- auth-access = Write
- Password-db = passwd
- Authz-db = Authz
3.2,PASSWD modified to:
- [Users]
- Username = password//Here the username and password set themselves
3.3,authz finally add the following two lines (these two lines resolve the SVN client to solve the authorization failed problem)
4, start Svnserve:
svnserve-d-r/home/myrepos/
5, the client uses:Client with SVN or TORTOISESVN client under Windows 5.1, from the Server checkout repository (under current directory)
SVN checkout svn://server IP address/5.2. Add some files yourself, or copy the previous items (such as the following three folders) to the current directory and ask SVN to help you manage code project document5.3, suppose I put the above three folders into the current SVN folder for SVN to manage, and then I'm going to add to the SVN repository: SVN add code Project Document//or directly with SVN add * 5.4, and finally commit to S VN Server svn commit-m ' import three directories ' Be sure to write a comment on the current version.
then configure the SVN hooks to automatically update the project file to the Web directoryOn the SVN server-side description: Server OS: Ubuntu (Linux) SVN installation path:/USR/BIN/SVNSVN project path:/HOME/SVNSVN login: YOURNAMESVN login Password: yourpassweb site root directory: /home/wwwroot/implementation Purpose: When there are any changes to the SVN project, the system automatically checks out the files from SVN in real time and synchronizes to the Web site root for specific actions: I. Automatically check out files from SVN in real time and sync to Web site root using SVN post-commit implementation
Cd/home/svn/hooks
CP Post-commit.tmpl Post-commit
Vim Post-commit#编辑, add the following code
Repos= "$" rev= "$" Export Lang=en_us. UTF-8 Svn_path=/usr/bin web_path=/home/wwwroot/ Svn_user=admin Svn_pass=admin Log_path=/tmp/svn.log echo ' Date ' +%y-%m-%d%h:%m:%s ' >> $LOG _path Echo ' WhoAmI ', $REPOS, $REV >> $LOG _path $SVN _path/svn update $WEB _path--username $SVN _user--password $SVN _pass--no-auth-cache >> $LOG _path |
: Wq #保存退出chown www:www/home/svn/hooks/post-commit #设置脚本所属用户组, www running accounts and groups chmod +x/home/svn/hooks/post-commit for Web Services # Add Script Execution Permission description: WhoAmI #执行此程序的用户REPOS = "$" #svn项目绝对路径值REV = "$" #最新版本号--no-auth-cache #不保存账户认证信息二, client testing after adding a file using the SVN client, Do SVN add and submit operation into the server/home/wwwroot directory can see the file submitted to SVN has been automatically updated to the Web directory to this point, Linux under the SVN server automatically update files to the Web directory tutorial completed.
PS: You may encounter this problemSkipped "/home/wwwroot" in the log file and then submit the file is not automatically updated in the Web directory my workaround is:
cd/home/wwwroot/
svn checkout the IP address of the svn://server.
then your newly submitted file will be automatically updated to the Web directory.
analysis Reason: The/home/wwwroot/directory does not exist. SVN directory, SVN does not know/home/wwwroot/
after checkout, the. SVN directory is generated in the/home/wwwroot/directory, and the submitted files are then recognized and automatically updated to the directory.
How to build SVN server and automatically update project file to web directory (WWW) under Linux