Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!).

share|improve this question
    
This should be a blog post, or maybe even a tech support article on Bluehost's site. At the very least please make it Community Wiki. –  squillman Sep 19 '10 at 0:08
1  
what's it got to do with bluehost, this tutorial applies to any webhost with SSH. –  gbjbaanb Sep 19 '10 at 0:30
    
@squillman I made it a Community Wiki; if it's a problem, I can just delete the post. I've just been pulling my hair out the last few days trying to put together disparate advice I got from several different blogs post, so I thought this could help someone in my shoes. –  attack Sep 19 '10 at 0:35
    
@gbjbaanb I was under the impression that Step 8 wouldn't be required under normal circumstances (BlueHost has disabled .bash_profile access for non-interactive log-ins). I'll edit the title if it's more generally applicable, though. –  attack Sep 19 '10 at 0:39
    
Thanks for the contribution, attack! –  Wesley Sep 19 '10 at 6:50

1 Answer 1

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.

share|improve this answer
    
Is there any way to use svn:// or http:// on a shared bluehost server instead of svn+ssh ? I would like to manage multiple users with multiple projects, and i can't find a way to get svnserve running as easy as it is to run on my local pc :( –  Dany Khalife Jun 6 '13 at 13:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.