Software Development > Solving TortoiseSVN, SVN+SSH, Putty and Plink Chaos

Solving TortoiseSVN, SVN+SSH, Putty and Plink Chaos

By LEONARD MCGAVIN
Published: December 7, 2008

Using the SVN+SSH protocol scheme should be a simple matter for TortoiseSVN and Putty. Strangely the web is littered with people having a lot of trouble connecting to SVN repositories with few solutions to be found. This article is bit of a troubleshooting guide and based on a number of assumptions that are listed at the end of the article.

ErrorsCommon errors when connecting to a svn+ssh repo include...
FATAL ERROR: Network error: Connection refusedand...
Invalid Port NumberThe latter of the two is caused when you change the network settings SSH Client value in TortoiseSVN from blank to the path to Putty. Forget that one. You don't need to complicate this. Change it back to blank so it uses Plink again. Plink is based on your Putty sessions anyway.

So, once you've set the value back to blank you will be left with the original FATAL ERROR and your gripe is now with Plink.

Plink with PuttyTortoiseSVN comes with its own version of Plink (TortoisePlink.exe in the bin directory). Get yourself a copy of Plink from the Putty download page for testing.

Once you've got it, open your Command Prompt and either change to the directory containing Plink or add the path to your PATH var like...

> set PATH=%PATH%;c:\Program Files\PuttyNow you can tinker with Plink directly and get some more info on the "FATAL ERROR: Network error: Connection refused" error. Running the following should just show the options for plink.
> plinkIn my case running the command saw plink trying to make a connection. What the fsck? Running it with the verbose option gave me a clue as to what was going on.
> plink -vPlink was grabbing my "Default Settings" Putty session and was trying to access it. This was a fault on my behalf as I hadn't realise I'd overwritten the default setting while setting up another session on another occasion. I cleared out the host name and saved the "Default Settings" session and Plink was staring to act a little more normal.

Now running Plink to make the connection works a treat.

> plink -i "c:\path\to\key.ppk" user@hostnameAnd testing the method that TortoiseSVN uses for the connection...
> plink -i "c:\path\to\key.ppk" putty_session_nameMakes the connection and shows we're now laughing! You should now have no problem getting the repo browser to connect. If you are still having problems the verbose output for Plink is extremely useful for debugging.

Other issuesOn the TortoiseSVN site there is the advice to test the set up using following command.
$ ssh svnserveIf you get the reponse "ssh: svnserve: Name or service not known" you may not need to be too concerned. You just need to be sure the remote user can access svnserve. You can test by doing...
$ which svnserveOther advice on the web mentions to add command="/home/usr/bin/svnserve -t" to the authorized_keys file. I didn't find this neccessary to make the connection work.

AssumptionsYou can access your remote server with a set of SSH keys via Putty. (It doesn't matter how you generate the keys so long as they work.) This step is detailed in many other articles.

The session you created in Putty has a name that doesn't have any spaces or weird characters.

The SVN repository is working and there are no permissions issues with user. This can be tested by checking out a local copy on the remote machine.

...

Standard disclaimers apply to this article. The advice given comes with no warranty and should only be taken at own risk.

Comments

1. Webmaster Code Promo on July 28, 2009

Thanks Luke, you saved my day. I was getting crazy with the TortoisePlink.exe and Plink.exe network error: "Connection refused";

Thanks to the magical -v option, I understood that I too had a default session, and that plink was ignoring the one provided on the command line :-(

It's now working, thanks a lot!

2. Johny on April 14, 2010

Thanks man, helped me a lot - I deleted the hostname in the Default Settings in PuTTY, now Plink doesnt ignore the hostname at the command line.

3. Dara on October 16, 2010

Thanks so much for help. I was getting the "FATAL ERROR: Network error: Connection refused" error as well. Spent almost an hour trying to figure it out. Finally I cleared the default settings as you suggested and it works like a charm.

4. Lennart on March 5, 2013

I also had to ensure Putty's Default Settings had "SSH" selected (and empty host name) to get rid of the error.

Thanks for the tips

Any Comments?

SilverStripe: MVC and Template Engine

By LEONARD MCGAVIN
Published: May 9, 2010

The templating system for the SilverStripe framework is a majorly crippled piece of work. The big question is: why?

SVN and Dreamweaver CS4 Integration

By LEONARD MCGAVIN
Published: June 30, 2009

Adobe Dreamweaver CS4 now comes with SVN integration. It's their one big feature for developers in this version. Too bad it's completely useless.