Safe to have /.svn/ folders on live site? (How to remove them but retain svn update capability?)
I'm doing svn update to update the code for my php website, but it leaves .svn/
folders all over.
I think its dangerous to leave those files publically readable, but its very easy to update the system.
Is there a way to use svn update
to update the system, but not to export the .svn/
folders?
Solution 1:
If you are using apache:
<Directory ~ "\.svn">
Order allow,deny
Deny from all
</Directory>
That will block people from accessing .svn
directories remotely (using the browser) but you can keep then (and svn capabilities) on the project.
BTW you can substitute \.svn
for \.git
or \.cvs
if you are using something different than subversion.
Solution 2:
you should change apache configuration so that it denies acess to .svn folder. this thread has more info https://stackoverflow.com/questions/398008/deny-access-to-svn-folders-on-apache
Solution 3:
You are wanting to export your code from the SVN to the live site...
Don't use svn update
for that. update is meant for use with updating working copies, not exporting the code. Use svn export
instead as it exports a clean directory tree from the repository specified.
The --force
flag will allow the export to overwrite the existing files.
SVN Export manual entry