For as long as I’ve been making money programming, I have been using CVS for version control. And, while it’s served me faithfully over the years, it is showing its age, having trouble coping with our multi-million line codebase and our ever-growing dev and test teams. Everyone says Subversion is the way to go, so I decided I’d give it a shot for a personal project this week.
Like Ken, I upgraded most of my dev boxes to Vista this week. Why does that matter? Well, I hear from several friends that Cygwin doesn’t work well on Vista, and I only allow network access to source control over SSH, which for me always meant OpenSSH via Cygwin. So, that means going to get Putty and PLink, and associated utilities.
To cut to the chase: I ran into a bunch of little issues, found lots of misinformation on the web, and generally had to goof with this for hours to get it working. So, here’s what I came up with; hopefully it will be helpful to the next person who walks this path.
One more piece of background: the network Subversion server I set up is running on a Debian Sarge server, using Subversion 1.3 from backports.org. I used the stock OpenSSH server. Now, on to the show.
Step 1. First, you need a Subversion client. I downloaded the latest Win32 release from subversion.tigris.org. I haven’t ever been much of a GUI guy, so I can’t really say much about the various other clients; I just tend to stick with the command-line client. That’s what I tested with.
Step 2. Next, you need an SSH client. I got Putty and its associated tools. I put the programs in a directory under Program Files, because it seemed like the right thing to do.
Step 3. Add both the Putty directory and the Subversion binary directory to your path. You should be able to open a command prompt and type putty
and svn
and have the programs run.
Step 4. While it’s probably not strictly necessary, I generated a private/public key pair using putty’s key generator tool. You can pick whatever algorithm and key length you want (2048-bit RSA if you’re worried). Save the key pair in your home directory. Note that, at least for OpenSSH, you do NOT have to export the key pair to a separate key - the .ppk file that Puttygen leaves you has an appropriate key already.
Step 5. Do the key exchange - open your .ppk file and grab the public key (the part that starts with the AAAA’s) and add it to your .ssh/authorized_keys file on the server. When you’re done, you should be able to connect to the server without supplying credentials, like so: plink server.name. Setting this up for the first time is confusing to a lot of people for some reason. Keep trying until you get it - it will make your subversion experience (or cvs for that matter) a lot more enjoyable.
Step 6. Configure Subversion. On Vista, the config file is in a subdirectory of your home directory, in the AppData\\Remote directory. Find the SSH line and change it to: ssh = plink -i c:\\path\\to\\id.ppk -batch. Note the double-backslashes; they’re important.
That’s all. Try it out by typing svn ls svn+ssh://server.name/repos and make sure it returns something reasonable.
Feel free to drop questions if you have trouble; I’d be glad to help if you ask while I still remember what I’m doing.