Fix Invalid Port Number Error with TortoiseSVN and PuTTY

I just wasted an hour on this, so I hope that explaining the solution here will help someone. If you’re using TortoiseSVN and PuTTY, perhaps using a private key created with PuTTYgen (like me), then this probably applies to you. I’m using Windows XP Pro, but Home is probably the same. I didn’t have this problem before because I just used cygwin’s ssh.exe which worked fine.

PuTTY Internal Error
Invalid Port Number
For TortoiseSVN’s SSH cilent, leave the box blank. Do not choose putty.exe, that doesn’t work. Blank is fine, TortoisePlink is fine. Otherwise you see the error above. When you enter the URL to the repository, use the PuTTY saved session name instead of the server name. For example, if your session is MyConnection, use MyConnection for the server instead of, for example, svn.osafoundation.org.

77 Responses to “Fix Invalid Port Number Error with TortoiseSVN and PuTTY”

  1. Sorth says:

    Totally saved me hours of frustration. Thanks much!

  2. Geoff says:

    Still helping people, thanks.

    It works, but how does Tortoise know where Putty is?

  3. Trevor says:

    This doesn’t work for me. I’m special ;)

    I was trying to port forward through a firewall to the svn server. The firewall was accepting from a port like 11111 and remapping to 22, forwarded to svn. I was using tcpdump to monitor everything. The putty saved session logs in fine. However, I get the usual ‘invalid port’ when trying tortoise, so I tried this suggestion of using tortoiseplink. The port error goes away, but as the session is trying to authenticate, it keeps prompting me for a password. The dialog that pops up prompts me to enter a password for user ‘svn@myfirewall’, NOT ‘svn@mysvnserver’, so I suspect that its not handling the fact that its getting forwarded by the firewall. ie. using the wrong login creds.
    Tcpdump shows that the authentication IS actually trying to work on the svn server behind the firewall, it just fails….again, just tortoise being daft. Putty works fine.

    I have a solution which I think will work (put an authenticator on the public side), but was wondering if anyone else was trying the same thing as I had here.

    • Trevor says:

      actually it is working….sort of. If I type in my password for the account, it prompts me a few times (probaby for each svn command its issuing) and the server accepts it. The auth log on the svn server shows that its accepting the passwords, and I eventually get the repository data.
      So now the issue is – why doesn’t tortoiseplink use my session key ? It never attempts it, there’s no attempt in the auth log.

      more if I fix it.

      • Trevor says:

        ^@#%^$%#!
        OK, it appears tortoiseplink is busted. It cannot use putty profiles made by putty, probably a version issue. Tortoiseplink is just a rebuilt plink to stop those annoying plink cmd shell popups, but issuing tortoiseplink and plink commands in a dos shell proves that plink is happy, tortoiseplink isn’t

        • Trevor says:

          ok, last time I talk to myself honest.
          A workaround is to use pageant. Works fine, no popup crud.

  4. Mike says:

    Thanks! You saved me some time — I just wish I had checked Google 20 minutes ago :P

  5. prasanna k rao says:

    thanks a lot… that saved me!!!

  6. Aday says:

    Hey thank u very much that helps my a lot! U solve that solved my problem preffectly.

  7. Javier Lopez says:

    Thanks a lot! Leaving it blank it solved my problem. In my case, it doesn’t work writting a PUTTY’s saved session name, but doesn’t matter because TortoisePlink is fine.

  8. seva says:

    Thanks a lot!

    I almost gave up on this.
    It turned out to be so easy! ;-)

  9. Claudio says:

    Thanks!!! Saved me a lot of time! :)

  10. Jesse says:

    THANK YOU!!

  11. Kiran says:

    Thank you :)

    We spent more than an hour trying to figure out why the heck were we getting this message!!!!

  12. Ryan says:

    Sorry this solution does not work on windows 7 64bit

  13. hoho says:

    Saved me too

  14. Sam says:

    Excellent, took me ages to find this – thank you.

    I also had problems with the repository URL when using svn+ssh:// for anyone with the same issue you enter it as you would navigating from the root directory eg:

    svn+ssh://your.server.com/var/subversion/youRepositoryName

    When prompted for a username and password enter your SSH credentials.

  15. Kleag says:

    Wow, still so usefull 5 years after the message !

  16. Illya says:

    Haha mate, I was Googling for something at work and came upon this, what a coincidence.

  17. Alexis says:

    Great!

    Thank you very much. A lot of time spent before I find this simple but unexpected solution. 6 years and your post is still helping people.

  18. Danny says:

    Didn’t save me hours, but did at least provide a solution at the end of those hours. It’ll save my teammates hours, I guess. :) Thanks!

  19. Peter says:

    Thanks mate!

  20. Vince says:

    Thanks a lot, that should be the first post when you type “tortoisesvn port forwarding issues” or “tortoisesvn routing policies”. HTH for seo :)

  21. Cédric (l'autre) says:

    thank you very much

  22. Paul says:

    Great! Thanks alot!

Leave a Reply to Trevor Cancel reply