In the previous article, we saw how to set up Subversion and access it through TortoiseSVN on Windows. You may have run into the multiple password prompts. Annoying? I thought they might be. Today you'll see how to make those little annoyances disappear.
You're going to need a few tools to help you out here. On Windows, there's an excellent SSH client called PuTTY. From the download page, grab PuTTY if you don't have it, as well as PuTTYgen. I also use a tool called WinSCP to copy files to my Windows machine.
What we're going to do here today is create a password-less key, then tell TortoiseSVN to use that key to authenticate to your Subversion server.
First, log in to your server using PuTTY. Then type the following to generate a key:
$ ssh-keygen -t rsa -b 1024 -f filename.key
Press Enter twice without entering a password when it asks, and you've created your password-less key. You'll have two – a public key called
filename.key.pub and a private key called
Next, if it doesn't exist, create a directory called .ssh and copy the public key into the authorized_keys file:
$ mkdir .ssh
$ cp filename.key.pub .ssh/authorized_keys
Quit PuTTY, then fire up WinSCP and login to your server. Copy the
filename.key file to your Windows machine. Then start PuTTYgen. From the Conversions menu, select Import, then browse to and select
filename.key. Leave the passphrase boxes blank and select Save private key. Click Yes on the confirmation box, and save your key with a ppk extension, like
filename.ppk. That's a key that PuTTY can use.
Start PuTTY again. Fill out the hostname box, then scroll down to SSH > Auth. Browse for your filename.ppk file. Then go back up to Sesson, give the session a name (let's use mysession) and save it. Test by logging in. PuTTY should say it's using the filename.ppk file and you should not be prompted for a password. So far so good!
Now, back to TortoiseSVN and ditching the prompts. First, create a new folder, then right-click said folder and select SVN Checkout. In the dialog box, enter this in the URL field:
To break it down a bit, svn+ssh is how TortoiseSVN will access your server, username@mysession is your credentials for logging in (mysession is the one we set up using the keys in PuTTY, remember?), and /opt/svn is where the repository is located on the server.
Click OK, and a few seconds later you should see the Completed message, all without entering one annoying password!