Auto updating (svn up) working copy on commit

I am working on a project that can’t be tested locally. So, I need to upload files to server. However, committing and then uploading is rigorous job (as there are lots of files to upload as a directory while changes were made only a few files under different directory. so browsing directory and uploading specific file(s) also annoying.) ! That’s why I used ‘svn up’ command to update all changed files from svn repository.

However, recently, I had to commit so frequent that committing and then updating server’s copy was also became irritating. So, today I tried to make a post commit hook that will update the server’s copy automatically after each commit. So, I just need to commit and then test on browser :).

The hook is simple. Just 3 lines of codes. Say my project’s svn repo is in /svn/project1, I have put the following code in /svn/project1/hooks/post-commit

svn up –username SVN_USERNAME –password SVN_PASSWORD

You need to put appropriate value instead of values written in block letters. Then make the file executable by the user who is running svnserve! The worse permission may be 555! But, I guess you know what you have to do :). Also, make sure svn user has permission to access your directory where to update!

That’s it!

  • Thanks for the post. It helps me lot.
    However, I was looking for a FTP base solution.

  • The HungryCoder

    You can do it using Netbeans. Configure Netbeans to upload files to server through FTP on Save/Run. You can do it easily!

  • You can still use FTP or deploy via other formats while using SVN. Try They let you deploy projects 5 times a day. Which is really good for small projects. You wont have to worry about exporting it at all. Finish coding, commit and deploy 🙂

  • The HungryCoder

    Lelin vy,
    Thanks for your comment. Yes, I am familiar with Springloops but my client’s strict policy not to upload codes in any server except his or mine :-s! He does not trust anyone. he he!

  • Geoffrey Tipton

    ftpdrive probably fits your requirement