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 only has usage instructions for Linux hosts.

The purpose of this article is to provide a way to use svnsync in Windows hosts.


The 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.

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:

  1. 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 C:\Repositories
    Using Command Prompt, go to C:\Repositories and create an empty repository there. Let's say that the name of the repository is Repo2Mirror. In that case, you should run a command like this:

    C:\Repositories>svnadmin create Repo2Mirror

    The command above will not output any messages, but the repository will be created.

  2. Exploring Repo2Mirror you'll see you have a hooks directory. The files in this directory are Linux bash scripts and won't work in Windows hosts.
    The svnsync program needs to store some special properties about its own synchronization 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 pre-revprop-change.bat at C:\Repositories\Repo2Mirror\hooks having the following content:

    IF "%3" == "svnsync" (goto :label1) else (echo "Only the svnsync user can change revprops" >&2 )
    exit 1
    goto :eof
    exit 0

    Feel free to change the username svnsync as you wish.

  3. Go back to C:\Repositories and run a command that follows this example:

    C:\Repositories>svnsync init --sync-username svnsync file:///C:/Repositories/Repo2Mirror --source-username svnadminusr --source-password svnadminusrpwd
    Copied properties for revision 0.

    a) The username specified in sync-username parameter is the one that will be validated by the pre-revprop-change.bat script
    b) The URL file:///C:/Repositories/Repo2Mirror refers to the empty repository created in Fisheye server
    c) The username and password specified in source-username and source-password should be from a Subversion administrator user that has access to the entire tree of the remote repository
    d) The URL refers to the remote repository you want to clone onto the Fisheye server.

    Note: credentials for the source repository can be provided using --source-username and --source-password and for the destination using --sync-username and --sync-password. These credentials are cached in the same way other credentials are cached.

  4. Go to C:\Repositories\Repo2Mirror and run this command in order to start syncing (remembering to change the URL to mach the repository created in Fisheye server):

    C:\Repositories\Repo2Mirror>svnsync sync file:///C:/Repositories/Repo2Mirror
    Committed revision 1.
    Copied properties for revision 1.
    Transmitting file data .
    Committed revision 2.
    Copied properties for revision 2.
  5. At this point, you should be able to add the synced repository in Fisheye using file:///C:\Repositories\Repo2Mirror as Repository URL (with a special note the mixed slashes).


In some use cases Fisheye might report a NonWritableChannelException error when trying to index the local repository created with svnsync:

java.nio.channels.NonWritableChannelException com.cenqua.fisheye.rep.RepositoryClientException: java.nio.channels.NonWritableChannelException java.nio.channels.NonWritableChannelException: null

This error means that either Fisheye or Subversion needs write permission in the directory configured for indexing but just read-only permission is granted, which suggests there is a lack of permission in the file system causing this issue.

Following the example above, right-clicking on C:\Repositories\Repo2Mirror, selecting the Properties menu, unmarking the Read-only flag and saving changes won't help: when the Properties panel is opened again the Read-only flag will be marked again.

Resolution 1:

The KB article SVN indexing fails due to NonWritableChannelException provides some possible resolutions.

Resolution 2:

This external webpage here explains how to prevent Windows from marking the directory as read-only again. In the local instance where the NonWritableChannelException error was troubleshooted, all suggestions from the external webpage (instead of one by one) have been tried at once before trying to index the repository again in Fisheye, so it could be that not all suggestions given there need to be followed for fixing the error, but the fact is that Fisheye was able to index the repository.

Please note that some of the suggestions from the external webpage may result in lowering security on the server. Therefore, it is recommended to discuss about the implications of following those suggestions with your Windows administrator / security practitioner before modifying anything.

Resolution 3:

Some customers have been able to fix this issue by granting Fisheye to the network service account for the mirror repository folder.

最終更新日: 2022 年 2 月 24 日


Powered by Confluence and Scroll Viewport.