Search code examples
svnpost-commit

Is it possible to automatically transfer/ftp files to a server, every time I commit a change to a svn repository?


Is it possible to automatically transfer/ftp files to a server, every time I commit a change to a repository??

If yes, please help me know how to set it up.

Thanks.


Solution

  • As you tagged the question, you want a post-commit hook to run the copy. You could get away with just using scp:

    scp -r /path/to/source/dir user@host:/path/to/destination/dir/
    

    You'll need to create an SSH key on your SVN server and add the contents of the public key file (the one ending in .pub) to the target machine's ~/.ssh/authorized_keys file to let you get away without needing a password.

    EDIT: full sample postcommit hook:

    #!/bin/bash
    scp -r /path/to/source/dir user@host:/path/to/destination/dir/