Skip to main content

Using non-standard SSH port with TortoiseSVN

Some of my students reported that they were having problems connecting to their repositories using TortoiseSVN. At first, quick checks from my end didn't reveal what caused these, but I realized soon that it wasn't a server issue. It seems like the client software that they were using (TortoiseSVN) didn't know what to make of the svn+ssh://[user]@[ip]:[port]/[repo] URL.



I use RabbitVCS on my Linux boxen and get the same "Network connection closed unexpectedly" message. A colleague at work suggested that since a non-standard port for SSH is used, I should modify my /home/<username>/.subversion/config , look for the [tunnels] section, and append -p [port number] for the svn tunnel named ssh. Since this particular repository is just one among the dozens I access, I can't modify the default svn tunnel. Instead, I added a custom tunnel for each of the servers that use non-standard SSH ports.


 



For the repo that my students were trying to access, I used ssh2212 = $SVN_SSH ssh -q -o ControlMaster=no -p 2212. So the URL now looks like svn+ssh2212://[user]@[ip]:2212/[repo] and I was able to connect successfully.



In Windows, there are several ways to do this. Since the OS doesn't have a native SSH client executable, users will rely on Cygwin, Putty, or on TortoisePlink.exe (in newer versions of TortoiseSVN).



You can try any of the following solutions (they're all searchable in the Internets) and see if you can get around the problem. I've tried them all on a Windows guest OS on VirtualBox and only the last three solutions worked.



  • Using Putty: Use saved session name from Putty in the URL: svn+ssh://[user]@[saved putty session name]/[repo]. Make sure that you configure the session to already use the correct port.

  • Using Putty: Alternately, use IP:port format for the Putty saved session name so that you still use the svn+ssh://[user]@[ip]:[port]/[repo] URL format, but you're actually calling the saved session name.

  • c. Using client packaged with Tortoise. In TortoiseSVN settings -> Network, change SSH client to "C:Program FilesTortoiseSVNbinTortoisePlink.exe" and use standard svn+ssh://[user]@[ip]:[port]/[repo] URL.

  • d. Same as d., but for the SSH client, append -P [port number]

  • e. Using a wrapper script, such as the one provided here (excellent solution btw), and use it as the SSH client executable in TortoiseSVN settings -> Network.



Hope any one of these work for you. As an inside joke from one of my sysad friends, it was also suggested that I save myself the troubles and just log in to the server and revert to the default SSH port. LOL.

Comments

  1. I should note that that code gets added into /home/USERNAME/.subversion/config under the [tunnels] section.

    ReplyDelete
  2. Jon Doblados30 May, 2010 20:30

    Thanks for pointing this out. Edited the post.

    ReplyDelete

Post a Comment

Popular posts from this blog

Migs in the Office!

Miguel got real bored at home and wanted to go and meet his classmates. Since school doesn't start until the 7th, I decided to take him with me to the office. He immediately got busy with the miniclip games and ignored Mjolnir the whole time! [gallery type="rectangular" ids="3167,3166"]

Valentine Surprise

Each year, on Valentine's day, I usually surprise my darling wife with a letter/card, or a bouquet of roses. As it was a yearly thing, I knew she sort of expected these surprises; she'd look surprised, but I knew she wasn't really. Occasionally, she does get surprised. Like that time back in Cebu when I bought her a rather intricate bouquet of flowers. Her head spun when she found out how much I paid for it. Surprise! This year, however, is different. I was not able to prepare anything for her. I didn't get her anything, thinking that I'd just make up for it with dinner, or something. Yes, I didn't plan for this and I feel lousy actually. Last night, after my daughter gave me and my wife her home-made Valentine greeting cards, my wife started chiding me about what I was going to give her the next day. I gave her my usual "I'm not telling" smile and silently kicked myself. I wished I already had something ready, and I found myself already longing fo