Cannot Access SVN Repository Over SSH Due to Error - svn authentication cancelled

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

When using a private key to access the repository (without standard log in) and having set FISHEYE_OPTS to pass the necessary details, e.g.:

export FISHEYE_OPTS="-Dsvnkit.ssh2.key=/path/to/private/key/file -Dsvnkit.ssh2.username=userName -Dsvnkit.ssh2.passphrase=optionalPassphrase -Dsvnkit.ssh2.password=userpassword -Dsvnkit.ssh2.port=optionalPort"

Fisheye outputs the following error in the logs:

Caused by: org.tmatesoft.svn.core.SVNCancelException: svn: authentication cancelled
	at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.cancel(SVNErrorManager.java:30)
	at org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getNextAuthentication(DefaultSVNAuthenticationManager.java:201)

Diagnosis

Confirm the error to connect by making an SVNKit call directly from the command-line by using the JSVN script located in the FISHEYE_HOME/lib/svn directory. Edit this script (Windows - jsvn.bat, Other - jsvn) and add the FISHEYE_OPTS (see above) values to SVNKIT_VM_OPTIONS. If either a username or private key prompt is returned after running the following command then Fisheye too will fail:

jsvn.bat --no-auth-cache info svn+ssh://URL.to.svn.repository

Note, however, that the SVN server is available via an external Subversion client (e.g. TortoiseSVN).

For more information on JSVN check the following page:

Cause

As per the SVNKit documentation:

By default SVNKit tries to obtain all necessary information from the [tunnels] section of the config file that is located in the default SVN run-time configuration area. However if that information is not complete or not found at all, SVNKit tries then to use predefined system properties listed beneath.

svnkit.ssh2.key = /path/to/private/key/file
svnkit.ssh2.username = userName
svnkit.ssh2.passphrase = optionalPassphrase
svnkit.ssh2.password = userpassword
svnkit.ssh2.port = optionalPort

 

It is therefore likely that there is something defined in the [tunnels] section of the SVN config file. For example, the location of the private key was defined, however, the default username was omitted.  As a result, the location of the private key or the username supplied in FISHEYE_OPTS will not be used.

Resolution

Remove the definition from the [tunnels] section of the config file so that the system properties passed via FISHEYE_OPTS will be used. Confirm the edit was successful and verify Fisheye connectivity by making the SVNKit call directly from the command-line by, once again, using the JSVN script:

jsvn.bat --no-auth-cache info svn+ssh://URL.to.svn.repository


For reference, the config file is located in the default SVN run-time configuration area. The default configuration area is located at ~/.subversion in Linux and OS X and at C:\Documents and Settings\<userName>\Application Data\Subversion in Windows.

If the connection still fails, try passing svnkit.ssh2.author instead of svnkit.ssh2.username in FISHEYE_OPTS.


Last modified on Jul 31, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.