Description
Recently in the window with a virtual machine installed an Ubuntu system, set up the PHP environment, in order to easily view the code under the window, so want to build an SVN, directly to the corresponding web directory code, and then use the SVN hook,
SVN directory:/HOME/SVN
Station Directory:/var/www/html
Realize
1. Find the hooks directory of the SVN project, this is/home/svn/hooks. The default in the directory will be several corresponding actions of the hook template, we need to create a post-commit file
2. New Post-commit, content as follows
#!/bin/sh
Repos= "$"
rev= "$"
Datetime= ' Date +%f '
Datetimeminute= ' Date +%h%m%s '
SVN=/USR/BIN/SVN # You SVN's absolute path <span style= "color: #ff0000;" > This path can be found with the which SVN command </span>
Web=/var/www/html/helloyii #检出的web站点根目录 Helloyii as the project directory
Log=/tmp/svnhooks_${datetime}.log
$SVN Update $WEB--username username--password password--no-auth-cache #username你的用户名 password your password
3. Modify Post-commit Permissions
# Chmod-r 777 Post-commit
4.Checkout a code to the Web server
# cd/home/www/html
# sudo svn checkout svn://127.0.0.1/helloyii
5. Test
Test, I am here to modify the version library locally, point to commit, and then look at the Web (nginx) server data is updated to test.