Pergunta

When I attempt to checkout:

svn checkout svn+ssh://serveradmin%foo@foo.com/home/87292/data/svn/repository/trunk .

I get this (unhelpful) error:

svn: Network connection closed unexpectedly

What's happening?

Foi útil?

Solução

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

Outras dicas

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://username@domainname.com: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://username@domain.com/home/username/svn/myproject

That’s it!

Hope that helps. Rick

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

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

I was connecting to a local 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.

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

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 ?

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

It should NOT be:

    user@host.com:/path/to/repo 
                 ^
                 spurious colon should be removed  

but should be:

    user@host.com/path/to/repo

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.

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.

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.

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.

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

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.

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top