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 eve开发者_如何学Cr 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?
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>
You can configure Apache to disallow access to .svn
directories but you'd still need that your remote server has access to your local Subversion repository, with all the stuff that needs to be configured and secured: encryption, authentication, routers, firewalls...
I think the best compromise between flexibility and simplicity is actually using FTP but doing it with a file synchronization tool. You can either export your working copy into a temporary directory and synch from there or configure the tool to ignore the .svn directories. The synchronization process can be slow but being automated it doesn't really matter.
Also, don't forget about non-versioned files. Some need to be updated manually (such as setting files created from versioned templates) and some need to be ignored (such as cache files and user data).
As about the magic tool to do this all... I'm still looking for right one. So far, I'm using SyncBack freeware. It does the job but it's designed as a backup tool so it can be hard to configure.
精彩评论