How to use svnsync in Windows environments
The solution provided in this article is not supported by Atlassian because it does not involve Atlassian products directly, this is considered third-party product integration.
It is recommended to use svnsync in order to mirror remote repositories currently indexed via http/s protocol onto the Fisheye/Crucible server, so that you can access it with the file:// protocol and greatly increase the indexing speed.
However, the svnsync link in our documentation redirects to Apache documentation which has usage instructions for Linux hosts.
The purpose of this article is to provide a way to use svnsync in Windows hosts.
svnsync command is part of Subversion, so you must have Subversion installed on the Windows machine running Fisheye, otherwise the
svnsync command will not be found in that server. Subversion can be downloaded from here: https://subversion.apache.org/packages.html
After installing Subversion on the machine running Fisheye, please open a new Command Prompt and run
svnsync, just to make sure that the command is found. If it is found, you should see an output message saying
Type 'svnsync help' for usage.
After that, you should be able to follow steps similar to the ones from svnsync guide:
First, you need to create your destination repository in the Fisheye server. Let's suppose you want to mirror the repositories into a directory named
Using Command Prompt, go to
C:\Repositoriesand create an empty repository there. Let's say that the name of the repository is
Repo1. In that case, you should run a command like this:
C:\Repositories>svnadmin create Repo1 C:\Repositories>
The command above will not output any messages, but the repositor will be created.
Repo1you'll see you have a
hooksdirectory. The files in this directory are Linux bash scripts and won't work with Windows.
svnsyncprogram needs to store some special properties about its own syncronization activities. It does this by setting some properties on the repository at revision 0. In order to do this there has to be a valid pre-revision property change hook on the repository that calls
exit 0. This hook is also a perfect place to put your check that only a specific user (for example,
svnsync) is allowed to do things.
Please create a file named
C:\Repositories\Repo1\hookshaving the following content:
IF "%3" == "svnsync" (goto :label1) else (echo "Only the svnsync user can change revprops" >&2 ) exit 1 goto :eof :label1 exit 0
Feel free to change the username
svnsyncas you wish.
Go back to
C:\Repositoriesand a command like this example:
C:\Repositories>svnsync init --sync-username svnsync file:///C:/Repositories/Repo1 --source-username svnadminusr --source-password svnadminusrpwd http://examplecompany.com/svn/Repo1/ Copied properties for revision 0.
a) The username specified in
sync-usernameparameter is the one that will be validated by the
b) The URL
file:///C:/Repositories/Repo1refers to the empty repository created in Fisheye server
c) The username and password specified in
source-passwordshould be from a Subversion administrator user that has access to the entire tree of the remote repository
d) The URL
http://examplecompany.com/svn/Repo1refers to the remote repository you want to clone onto the Fisheye server.
Note: credentials for the source repository can be provided using
--source-passwordand for the destination using
--sync-password. These credentials are cached in the same way other credentials are cached.
C:\Repositories\Repo1and run this command in order to start syncing (remembering to change the URL to mach the repository created in Fisheye server):
C:\Repositories\Repo1>svnsync sync file:///C:/Repositories/Repo1 Committed revision 1. Copied properties for revision 1. Transmitting file data . Committed revision 2. Copied properties for revision 2. ...