Skip navigation

How do I make an export (local backup) of my repository?

tl;dr

Use svnsync to replicate your remote repository to a local one, then optionally create a dump file with svnadmin dump.

Exporting and backing up your repository with svnsync

You can easily make a local backup of your full repository with the svnsync tool.

The procedure is as follows:

  1. Find the URL for your repository. Here, we’ll assume the repository URL is https://svn.sliksvn.com/your_repo.
  2. Get the Subversion command-line client. On the command prompt, try typing svnsync. If this command is not successful, install a Subversion client, such as SlikSVN for Windows.
  3. Create a Subversion repository on your local hard drive:
		svnadmin create backup_repo
	
  1. You now have a backup_repo directory on your local system, containing an empty Subversion repository.
  2. If you use a Unix system, create a pre-revprop-change hook as follows:
		echo '#!/bin/sh' > backup_repo/hooks/pre-revprop-change
chmod 755 backup_repo/hooks/pre-revprop-change
	

If you use a Windows system, create the pre-revprop-change hook like this:

		echo > backup_repohookspre-revprop-change.bat
	
  1. Determine the URL for the backup repository. Here, we’ll assume the directory is /Users/name/backup_repo, so its URL is file:///Users/name/backup_repo. If you are using Windows, the URL will have the form of file:///C:/Users/name/backup_repo (containing forward slashes).
  2. Run the following command to initialize the sync:
		svnsync init file:///Users/name/backup_repo https://svn.sliksvn.com/your_repo
	
  1. Run the following command to synchronize:
		svnsync sync file:///Users/name/backup_repo
	

You can always re-run the sync command later, in order to download the newest revisions from the remote.

If you want to create a dump file, use:

		svnadmin dump backup_repo > backup_repo.svn