The following commands should be run in the terminal (for example, using Putty in Windows) on the host where you want to export the repository). It’s recommended that you run them using the domain’s user, not root.
First make sure that Subversion is installed on the host. To check if it is installed, run:
If you don’t get a “command not found” message, subversion is installed. Otherwise, you need to install it.
The next step is to go to where you want to export the contents of the repository (eg.: “cd /var/www/vhosts/example.com/httpdocs” or “cd /home/sitename/public_html“).
The command looks like this:
svn export [-r <revisionNumber>] [--force] <repositoryUrl> <targetDirectory>
- -r revisionNumber – optional – export a specific revision. By default, the latest revision will be used
- repositoryUrl – the repository URL (eg: http://example.com/repos/project-name/trunk/). Remember to add /trunk/, or change it appropriately if you need to export a certain branch or tag
- ./ – means the current directory
- ./project-name – will export to the project-name subdirectory
- /var/www/vhosts/example.com/httpdocs – will export to an absolute path
- –force – optional – by default SVN will not export in an existing directory. if you want to override this, you have to use the force parameter. Be careful, this option can overwrite files
svn export http://v1.dotkernel.net/svn/trunk ./ --force svn export -r 423 http://v1.dotkernel.net/svn/trunk ./ --force svn export http://v1.dotkernel.net/svn/trunk /var/www/vhosts/domain.com/httpdocs/dk
For more information, you can run svn help export.
If you’ve exported the repository using a different user (root for example), you can change the permissions back by running the following command as root:
chown -R siteuser.psacln /var/www/vhosts/example.com/httpdocs