Usha Guduri

SVN+SSH: network connection closed unexpectedly

After a long time, I had to work-from-home today because I hurt my shoulder badly. And something with the firewall and/or VPN settings seems to have changed that I couldn’t access the code base anymore. What more can you ask for WFH ;-)

I spent enough time to figure this out that I thought best to note it here. svn was caughing with:

$ svn ls svn+ssh://myhost/myrepo
svn: To better debug SSH connection problems, remove the -q option from ‘ssh’ in the [tunnels] section of your Subversion configuration file.
svn: Network connection closed unexpectedly

The configs(~/.ssh/config and /etc/ssh_config) had nothing specific to tunnels anywhere. I could login to myhost just fine and also port forward to it without problems like before, using the long standing aliases - so nothing stood out. Preliminary instinct is to purge the known_hosts file in ~/.ssh/known_hosts and rebuild it in case the host’s address had changed - no luck. You could see what ssh is doing on a connection with ssh -v, but this is svn+ssh, isnt it? a one-liner to the rescue!

$ export SVN_SSH=”ssh -v “

and then do retry the svn command to see:

ssh: Could not resolve hostname myhost: nodename nor servname provided, or not known

Are you kidding me?! Your stupid error message ran me down a dark alley about tunnels and the problem was actually with the hostname?!

Solution:

  1. As simple as using the FQDN for myhost with each svn command:

     $ svn ls svn+ssh://fqdn.myhost.com/myrepo
    
  2. The above is cumbersome if you already have aliases set up or are working with new repos. Better yet is to add the actual IP address for the host to your hosts file in /etc/hosts:

     123.13.13.1 myhost
    

Lesson: Do not trust the error messages at face value until you get more debug info about where/who its coming from!

Comments