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:

svn --version

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>

where:

  • -r revisionNumberoptional – 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
  • targetDirectory
    • ./ – 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
  • –forceoptional – 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

Examples:

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

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>