Si vous cherchez mon site professionnel, merci de cliquer ici.
Fast website update with SVN
If you manage websites on a remote dedicated server, you probably waste many time on transferring code from your local machine to the remote one. You can script some ftp transactions, but it’s somehow not really secure. You can use scp, but it can be a pain with the need for password.
What I’ll discuss here is an other method : using SVN. The main advantage is to update the site in a simple command, and to be able to revert modifications easily.
The trick
The trick is quite simple. First, create a repository and upload the actual website in it. When it’s done, go to the final destination of your website and turn it into a working copy. Use chown to get it owned by svn.
Then, you need to add the svn user in the password table, in the conf/passwd file of your repository.
Finally, go in the hook/ directory of your repository and create an executable file named post-commit like this :
#!/bin/sh/usr/bin/svn update --username svn --password PASSWORD /PATH/TO/THE/FINAL/DESTINATION
You now just need to issue a “svn ci -m ‘reason’” in your local working copy to get your website updated.





Write a Comment