How to configure SVN on a web server?

I found this question , but it was never resolved and did not want to capture it for myself. I will try to 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 work with a Windows machine using TortoiseSVN .

I have several websites in my public_html/ on the hosting server, and I want any changes made on my Windows machine to propagate to the server with minimal clutter. I basically want to get away from manual FTP uploads.

I would be happy to save all my changes, but in fact they never need to see them, of course, not from the web interface. All I want to see from the Internet is the current revision.

Hope most of the details are sorted, now for the actual question. What is the best way to set my SVN to work in my public_html folder without publishing all of my .svn directories to the public?

+4
source share
2 answers

I would advise using a working copy of the production order. The best way to load into production is to export. If you want something automatically, you can explore some script deployment options, such as Capistrano.

If you still want to do this, you can use htacccess to hide them:

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

You can configure Apache to deny access to .svn directories, but you still need your remote server to have access to your local Subversion repository, with all the necessary settings and protection: encryption, authentication, routers, firewalls ...

I believe that the best tradeoff between flexibility and simplicity actually uses FTP, but it does so with a file synchronization tool. You can either export your working copy to a temporary directory and sync there, or configure the tool to ignore .svn directories. The synchronization process can be slow, but automated it does not really matter.

Also, do not forget about files without a version. Some of them need to be updated manually (for example, install files created from versions of templates), and some should be ignored (for example, cache files and user data).

How about a magic tool for this all ... I'm still looking for the right one. I still use the free SyncBack software . It does the job, but it is designed as a backup tool, so it's hard to set up.

+1
source

Source: https://habr.com/ru/post/1299318/


All Articles