Svn – Subversion, Bluehost, and TortoiseSVN

svntortoisesvn

Setting Up TortoiseSVN (on Windows) to SSH Tunnel to a Bluehost Subversion Server

I had a lot of trouble setting this up, so I hope this can be a resource to others. Please fix up any errors you find in my instructions.

1. Request SSH Access

You'll need SSH Access, so make sure you request that through the "SSH/Shell Access" option on your CPanel.

2. Download a SSH Client

You'll also need a SSH client, so download the latest version of PuTTY. You will also need a FTP client; I recommend FileZilla.

3. Install Subversion

Use PuTTY to log into your server and install Subversion using the following instructions (you may want to go ahead and update the version numbers):
http://www.bluehostforum.com/showthread.php?12099-Setting-up-Subversion-on-Bluehost

Make sure that you correctly installed Subversion by creating a repository at /home/username/svn and importing a project into it, using this tutorial:

http://svnbook.red-bean.com/en/1.5/svn.intro.quickstart.html

4. Create a SSH Authentication Key Pair

Bluehost won't allow us to tunnel directly over SSH (read more), so we'll need to set up some authentication keys.

You can do this via SSH, using this tutorial:
http://tortoisesvn.net/ssh_howto

Or you can simply log into your CPanel and create a SSH Key via the "SSH/Shell Access" option GUI. Either way, make sure you authorize the key (by manually adding it to authorized_keys as in the above tutorial or through the CPanel GUI interface).

Remember to provide a passphrase for your key. Many tutorials suggest leaving it blank so that TortoiseSVN won't prompt you for a password. However, we can set Pageant up for this very same purpose without creating an unsafe SSH key.

5. Convert the Private Key

After Step 5, you should have both a private key file (such as id_dsa) and a public key file (such as id_dsa.pub). Download the private key file to your desktop.

Download PuTTYgen.

Open PuTTYgen, go to Conversions > Import Key, and find your private key file on your desktop. Enter your private key's passphrase and then click "Save private key." Save the converted PuTTY key to a place that you will remember (and won't change).

6. Create a PuTTY Session

Open PuTTY and enter the following fields:

Session > Host Name: (Your Host Name)
Session > Saved Sessions Name: "Subversion"
Connection > SSH > Auth > Private key file for authentication: (Your Converted Private Key)

Go back to the "Session" screen and click "Save" near "Saved Sessions" to save this information.

Now that the Session has been created, select "Subversion" in "Saved Sessions," click "Load", and then click "Open". You'll be asked for your username as well as your passphrase, and then you should gain access to your server.

7. Configure the PuTTY Session in Pageant

Download Pageant.

Open up Pageant, and it should appear in your taskbar. Right-click the Pageant icon and select "Add Key." Find your private key file and then enter your passphrase.

Open up PuTTY again and reconnect using your "Subversion" session. You'll be asked for your username, but you should no longer have to enter a passphrase.

8. Add the svnserve Path Command to Authorized Keys

Find authorized_keys in /home/username/.ssh/ and modify this file so that the following appears right before your key (Pageant may block your FTP client, so you may need to close it):

command="/home/username/bin/svnserve -t" (KEY NAME) (KEY)

(Source: http://www.mikespicer.net/wp/?p=41)

9. Connect TortoiseSVN

Download and install TortoiseSVN.

Open up Pageant and again add your private key.

Right-click somewhere, select "TortoiseSVN > RepoBrowser," and a dialog box will come up. Type in "svn+ssh://username@Subversion/home/bin/svn".

You should now see your repository (finally!).

Best Answer

Troubleshooting

There are still a number of things that can go wrong:

If things still aren't working, download and install SilkSVN. This will allow you to issue Subversion commands straight from the MS-DOS Command Prompt.

Download Plink as well.

Find your local Subversion configuration file at: C:\Users\YOUR_LOCAL_USERNAME\AppData\Roaming\Subversion\config (source), and add the following to the [tunnels] section:

ssh = c:\\path\\to\\plink.exe

Now open a command prompt and try the following command (make sure Pageant is running with your key):

svn+ssh://username@Subversion/home/username/svn

Now you will get back more detailed error messages than you would through TortoiseSVN.

Related Topic