Sunday, November 25, 2018

svn - Subversion, Bluehost, and TortoiseSVN

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

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...