My host is HostGator (good speeds, reliable ssh, cgi-only, MyISAM-only, decent support, non-existent knowledgebase). HostGator runs SSH over port 2222 which presents a few problems when trying to use traditional methods to connect to an SVN repository via SSH.
For these steps you will need Putty. Just get the whole suite.
- Generate an RSA key using PuttyGen
- Copy the public key into your ~/.ssh/authorized_keys file on the server.
- Prepend your key with (so it's all on one line):
This sets up svnserve to run in tunnel mode. The ramification of this is that you can no longer use this RSA key to auto-login on the shell. There is some information out there about creating an svn.mydomain.com subdomain and only having this rule apply to that subdomain, which solves that problem. On *nix machines this involves adding a simple rule to your SSH keystore that says "use key X when connecting to svn.mydomain.com and key Y when connecting to mydomain.com". Then you would have two entries in your authorized_keys file, one with the svnserve command for connections to svn.mydomain.com using key X and one without for key Y.
- Now load your private key into Pageant
- Create a new Putty connection called mydomain.com.
- Set the the Auto-login username.
- Ensure that SSH->Auth->Attempt authentication using Pageant is checked.
- Create an SSH tunnel which forwards LOCAL port 22 to mydomain.com port 2222.
SAVE the connection and then test it by opening it. You should be logged in without having to provide a password.
SVN should now be working when you use TortoiseSVN (or a similar client I assume). However, svn from the command line will not work and will report "Can't create tunnel..."
Now to get SVN working from the command line.
- Create an SVN_SSH environment variable with value (keep the quotes and use forward slashes):
SVN will now use plink to try to connect to the svn repository. This will only work if the domain of your svn root's URL is named the same as the Putty connection you created i.e. mydomain.com.