9
votes

When I attempt to checkout:

svn checkout svn+ssh://serveradmin%[email protected]/home/87292/data/svn/repository/trunk .

I get this (unhelpful) error:

svn: Network connection closed unexpectedly

What's happening?

15

15 Answers

10
votes

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

9
votes

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

8
votes

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
7
votes

I had this same error, but for committing a revision. Clearing out .ssh/known_hosts fixed the problem because the SSH keys went stale.

2
votes

I was connecting to a local network svn and this happened to me from some point on (it actually happens periodically).

All the references I have found surfing mention something related with SSH. SSH may well be the root of my problem too somehow, but I managed to overcome the problem by killing some of the svnserve processes.

I can do this because I know what is the usage of my server, but don't know the relevance of doing this in a server with more concurrence.

0
votes

If you're using Putty, it saves your login credentials thus might make tortoise give the following error when you try to checkout: Connection closed unexpectedly. If this occurs open up putty and click on default settings so that the Host Name is loaded. Clear the host name and save. This worked for me...

0
votes

One other reason for getting this "svn: Network connection closed unexpectedly" error which I came across was that the /var was full , which caused for svn in not being able to write anything to disk. so maybe first check your disk space (du -m) before proceeding with the above steps ?

0
votes

Make sure you did not have a spurious colon in your svn url

It should NOT be:

    [email protected]:/path/to/repo 
                 ^
                 spurious colon should be removed  

but should be:

    [email protected]/path/to/repo
0
votes

In my case, while using svn+ssh, the error stemmed from the fact that gforge users didn't have home directories. I added them manually and the problem went away.

0
votes

Check your firewall settings. I had ConfigServer Security & Firewall (CSF) installed on my server which blocked the ssh+svn port 2222. I allowed the ports and was able to perform an update.

0
votes

I also had this problem after I have set up ssh on my linux server. The problem for me was that I have created the key with puttyGen. The public key file first had to be converted with puttyGen from .ppk file format. After that everything worked like a charm.

0
votes

Hi I encounter same issue on OS X Yosemite. I read all this answers and @notalbert comment is the path to resolve. It seems that OS X can't handle svn+ssh scheme, so adding

export SVN_SSH="ssh "

to /Users/username/.bashrc is my resolution.

Thanks.

0
votes

Other possible cause is that subversion is not actually installed in the server (e.g. the repository was moved to a new server).

0
votes

If you have already set up .bashrc to refer to your key in SVN_SSH but are then using sudo to execute svn the command will not be using your SVN_SSH and you may get this error.

I was using sudo to check out to a new directory I didn't have permission to create, the proper way is to sudo mkdir whatever, then set the correct permissions to allow you to write to it.

0
votes

E210002: Network connection closed unexpectedly

I had kept getting error above with ssh trying to connect using default port 22. issue resolved after specifying correct port for the host.