"Network connection closed unexpectedly" upon svn checkout

OK. Here’s how I fixed this (on Mac OS X, but fix should work on any client)

This particular issue arises when you are using a non-standard port (let’s say 12001 for sake of example) for your SSH server.

Apparently the SVN client experiences syntax errors when given a port address on a command line like this one:

svn list svn+ssh://[email protected]:12001/home/username/svn/myproject

So, to fix this, you need to create a client-side config file for SSH like this:

cd ~
cd .ssh
vi config (create a config file like the one that follows)
:w
:q

Config file located in ~/.ssh/config:

Host domain.com
User username
Port 12001

Then, issue your svn+ssh command WITHOUT the port like this:

svn list svn+ssh://[email protected]/home/username/svn/myproject

That’s it!

Hope that helps. Rick


This can happen due to an authentication failure. You may have cached credentials that do not match the site you're trying to access. You may need to register an SSH key with the site.

As suggested by the notalbert below, use SVN_SSH flag to get the detailed error in verbose mode

export SVN_SSH="ssh -v "

You might see some output like this on stderr,

Add correct host key in /home/jcrawford/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/jcrawford/.ssh/known_hosts:4
  remove with: ssh-keygen -f "/home/jcrawford/.ssh/known_hosts" -R 192.168.0.107
ECDSA host key for 192.168.0.107 has changed and you have requested strict checking.
Host key verification failed.

remove the line entry belonging to your svn server IP address, in my case it is 192.168.1.107, from the file ~/.ssh/known_hosts


I suspect Joel and Andy have it right.

You can use the ssh verbose flag to help figure out these kind of problems.

export SVN_SSH="ssh -v "
svn checkout svn+ssh://serveradmin%foo/blah blah blah

Tags:

Svn

Ssh

Openssh