Search code examples
svnapachetortoisesvnpublic-html

How to properly set up SVN on web server?


I have found this question, but it was never resolved and don't want to hijack it for myself. I'll try and give as many details as possible.

I have a shared hosting account on a Linux server which is my web server, and I have shell access.

I'm working from a Windows machine using TortoiseSVN.

I have several web sites in my public_html/ on the hosting server and would like to be able to have any changes made on my Windows machine be propagated to the server with minimum fuss. I basically want to get away from manually uploading over FTP.

I would be happy to keep all my revisions, but don't actually ever need to see them really, certainly not from a web interface. All I want to see from the web is the current revision.

Hopefully that's most of the detail sorted, now for the actual question. What's the best way to set my SVN to work in my public_html folder without exposing all my .svn directories to the public?


Solution

  • I would advice against using a checkout working copy on production. The best way to upload to production is export. If you want something automatically you could look into some deployment script like Capistrano.

    If you still want to do it .. you could use a htacccess to hide them:

    <FilesMatch "\.svn/.*">
       order deny,allow
       deny from all
    </FilesMatch>
    
    <Files .htaccess>
       order deny,allow
       deny from all
    </Files>