<p>I'm introducing Subversion into our web shop. I want to want the checked in files to be uploaded into the server via FTP (and as they get use to Subversion, via SFTP). The files are sent to a release candidate page for testing purposes. A script can be called to move the files into production.</p>

<p>My question is this: How do you transfer the files to the server via Subversion? Is there a script I can add that will do the transfer when the files are checked in?</p>

[{'answer_id': 14140, 'author': 'lomaxx', 'author_id': 493, 'author_profile': 'https://Stackoverflow.com/users/493', 'pm_score': 1, 'selected': False, 'text': '<p>I think what you\'re looking for is something like integration with an automatic build script. I have used <a href="http://cruisecontrol.sourceforge.net/" rel="nofollow noreferrer">CruiseControl</a> to do a similar thing with an ASP.Net application. I don\'t know your exact requirements but I\'d bet you could get it to do what you want.</p>\n'}, {'answer_id': 14147, 'author': 'roo', 'author_id': 716, 'author_profile': 'https://Stackoverflow.com/users/716', 'pm_score': 1, 'selected': False, 'text': '<p>Post commit scripts are useful for this. Essentially on every commit a script is called after the event, which you can use to perform an svn export to where-ever.</p>\n\n<p>An interesting <a href="http://arstechnica.com/articles/columns/linux/linux-20050406.ars" rel="nofollow noreferrer">article</a> shows how this might be done, and <a href="http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-5-sect-2.1" rel="nofollow noreferrer">this</a> shows how hook scripts can be used with subversion</p>\n'}, {'answer_id': 14150, 'author': 'Pat Notz', 'author_id': 825, 'author_profile': 'https://Stackoverflow.com/users/825', 'pm_score': 1, 'selected': False, 'text': '<p>You can probably use the SVN "hooks" to do this.  Basically, you can configure your server to run scripts before or after every checkin.  Here\'s the direct link to the relevant section of the <a href="http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html" rel="nofollow noreferrer">online book</a>.</p>\n'}, {'answer_id': 14153, 'author': 'ScottKoon', 'author_id': 1538, 'author_profile': 'https://Stackoverflow.com/users/1538', 'pm_score': 2, 'selected': False, 'text': '<p>You want to build a script that uses the post commit hook in SubVersion. You can either have the script export from your repository and then FTP to the server, or you can just checkout from your repository into a working directory on your server and call "svn update" on the servers working directory in your post-commit hook script.</p>\n\n<p><a href="http://subversion.tigris.org/faq.html#website-auto-update" rel="nofollow noreferrer">There\'s more information in the Subversion FAQ</a></p>\n'}, {'answer_id': 14154, 'author': 'Orion Edwards', 'author_id': 234, 'author_profile': 'https://Stackoverflow.com/users/234', 'pm_score': 3, 'selected': True, 'text': '<p>If you have shell access to your sever, and SVN installed on it (or the ability to install SVN), then your best bet may be just to bypass FTP entirely.</p>\n\n<p>How we deploy our apps is (simplified)</p>\n\n<ul>\n<li>Developers write code and check it into trunk</li>\n<li>Periodically, when trunk is stable, we will take a snapshot of it as a tag</li>\n<li>On the server, svn checkout the tag</li>\n</ul>\n\n<p>If any changes need to be made to the server (or directly on the live server itself) it is trivial to use subversion to sync the code</p>\n'}, {'answer_id': 14164, 'author': 'Bob Somers', 'author_id': 1384, 'author_profile': 'https://Stackoverflow.com/users/1384', 'pm_score': 0, 'selected': False, 'text': "<p>I second Orion's idea. If you've got shell access to the server, it's actually extremely easy to use Subversion itself as the deployment tool. Just make sure you have some web server rules set up so that you don't accidentally expose the .svn directories.</p>\n"}, {'answer_id': 14197, 'author': 'The How-To Geek', 'author_id': 291, 'author_profile': 'https://Stackoverflow.com/users/291', 'pm_score': 2, 'selected': False, 'text': '<p>I think you should probably use svn export rather than svn checkout for deployments, so you don\'t have those .svn directories muddying up your production backup jobs. svn export is a "clean" checkout.</p>\n\n<p>I\'d also create a script that handles it all for you. Depending on how your code is structured, you can often version your directories and just update a symlink to the latest version, which makes rollbacks easier.</p>\n\n<p>You could even use something like <a href="http://www.capify.org/" rel="nofollow noreferrer">Capistrano</a> to automate the deployments. I second the recommendation for CruiseControl, though.</p>\n'}, {'answer_id': 512752, 'author': 'gavinandresen', 'author_id': 58359, 'author_profile': 'https://Stackoverflow.com/users/58359', 'pm_score': 0, 'selected': False, 'text': '<p>svn2web will ftp or scp files from a subversion repository to a web server on every commit.  See the <a href="http://svn2web.sourceforge.net/" rel="nofollow noreferrer">SourceForge</a> project for details.</p>\n'}]
['https://Stackoverflow.com/questions/14135', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1599/']