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:
- Find the URL for your repository. Here, we’ll assume the repository URL is
https://svn.sliksvn.com/your_repo. - 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. - Create a Subversion repository on your local hard drive:
svnadmin create backup_repo
- You now have a
backup_repodirectory on your local system, containing an empty Subversion repository. - 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
- Determine the URL for the backup repository. Here, we’ll assume the directory is
/Users/name/backup_repo, so its URL isfile:///Users/name/backup_repo. If you are using Windows, the URL will have the form offile:///C:/Users/name/backup_repo(containing forward slashes). - Run the following command to initialize the sync:
svnsync init file:///Users/name/backup_repo https://svn.sliksvn.com/your_repo
- 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