About me
Services
Projects
Design Patterns
Archive
Contact
home > Archive > Subclipse

svn+ssh: Connecting to Subversion using Subclipse

After struggling with this configuration and not being able to find a working solution on the web, I decided to write up my own instructions. I am using Fedora Core 4 as my svn server (subversion-1.2.3-2.1) and configured remote access to the project on a Windows 2000 client and a Windows XP client. The setup was tested for Eclipse 3.1.2 and 3.2RC6. Let me know if this helps, or if you have any problems with the setup.
Assumptions:
PUTTY
  1. Download puTTY and puTTYgen from http://www.putty.nl/download.html. They are downloaded as executables, no need to unzip. Put them somewhere you can get at them, like your desktop.
  2. Startup puTTY, create a connection. Make sure you follow these instructions carefully, if you dont the connection will not work.
    1. Enter the hostname for your remote server. ie:svn.grahamlange.com
    2. Set the port as 22 (or different if you connect through ssh to your subversion server on a non-standard port).
    3. Select SSH as the protocol.
    4. Enter a name for the session, it must be the same as the hostname. This is very important.
    5. Click on Save.
    6. On the left menu, expand Connection, select Data. Enter the username you will be using to connect to your svn server.
    7. Click on Session and click on Save. (Dont forget to do this.).
  3. Double click the session name and ensure that you can connect successfully through ssh to your server. You should not be prompted for a password, if you are, then you have not created your key properly.
KEYGEN
If you dont already have a privatekey (sans passphrase) setup, follow these instructions to generate a public / private key.
  1. Login to your svn server through puTTY, as your svn user and in your home directory, generate a ssh key,
    ssh-keygen -t rsa
    You will be prompted for a location to save the file, accept the default. Make sure you dont enter a passphrase, just hit enter when prompted.
  2. This will generate a private / public key combination in your .ssh folder, copy the id_rsa.pub file to an authorized_keys file.
    cp id_rsa.pub authorized_keys
  3. Copy the id_rsa file to your remote (windows) machine, we will be modifying it with puTTYgen and using it to connect. (if you dont know how to do this, use winscp to copy the file.)
  4. On your windows machine, launch puTTYgen and select Conversions >> Import key, find the key you just copied from the server and click open.
  5. Leave the passphrase blank and click on save private key, save the resulting file in the same location but as id_rsa.ppk (ppk is for putty key.)
  6. Open puTTY again and load your session created in the previous section, goto Connection >> SSH >> Auth and browse to the id_rsa.ppk file created above.
  7. Save your puTTY session and click open. If all has gone well, you should be logged in without having to enter a password. If the server prompts you for a password, ensure your home folder permissions is rwx for the user only (chmod 700) SSH doesnt like it otherwise.
ECLIPSE (I)
  1. Download the most recent stable release for eclipse. This document was created when installing eclipse 3.2RC6 on a windows 2000 machine. Eclipse downloads
  2. Install Eclipse by extracting the download onto your drive. ie: C:\eclipse_3_2RC6\
  3. Create a workspace on your local machine, this will be where you will check out your project to, ie C:\myworkspace\
  4. Create a shortcut to the eclipse.exe file. Edit this shortcut so that is uses the workspace created in 2. ie: -data C:\myworkspace\ You will also want to include some other parameters for the startup.
    1. -showlocation (Show the location of your workspace on the title bar)
    2. -vm "C:\Program Files\Java\jre1.5.0_06\bin\javaw.exe" (default the jvm to use the one specified)
    3. -vmargs -Xmx256M (increase your max heap size to 256Meg.)
    The resulting shortcut property should look something like, C:\eclipse_3_2RC6\eclipse.exe -data C:\myworkspace\ -showlocation -vm "C:\Program Files\Java\jre1.5.0_06\bin\javaw.exe" -vmargs -Xmx256M
  5. Start eclipse, close the default startup page.
SUBCLIPSE
  1. Now, we will be installing the Subclipse plugin, complete install instructions can be found at http://subclipse.tigris.org/install.html.
  2. In Eclipse, cick on Help >> Software updates >> Find and install...
  3. Select 'Search for new features to install'
  4. If Subclipse is not already listed as a remote site, Click on 'New Remote Site' button.
  5. Fill in the dialog with the following,
    Name: Subclipse
    URL: http://subclipse.tigris.org/update_1.0.x
    Click OK.
  6. The features will be shown from the Eclipse site, select and click next.
  7. You will be asked to accept a license agreement and confirm the install location, click next.
  8. Click on install and the install will begin.
  9. Restart your workbench.
  10. After restarting Eclipse you should be able to open the SVN Repository Exploring Perspective.
TORTOISE
  1. Download and install TortoiseSVN, this will be used to Connect to export your project initially. Download TortoiseSVN
  2. In windows explorer, browse to your workspace ie: C:\myworkspace, right click and select SVN checkout.
  3. Enter your URL for the svn repository, it will look something like this, svn+ssh://svn.grahamlange.com/var/repository/svn-server-root/myproject
  4. Enter your checkout directory, it will be the same as the workspace.
  5. You can leave the rest as defaults, click ok. Depending on the size of your project, it may take a few minutes to finish the checkout.
ECLIPSE (II)
  1. Start Eclipse. Select File >> Import your project from your workspace. If you get a "overlaps the workspace location" type of error, then you have created your project on directory to low in your workspace. All Eclipse projects must be directly below the workspace directory, otherwise you get an error.
  2. Change to your SVN browsing perspective.
  3. You should see a connection to your SVN repository there already.
  4. Click on the location to expand it and ensure you can browse the repository.
  5. Go back to your project and make sure you can see the resource history for some of the files in your project.

GOOD LUCK!

Copyright 2008 Graham Lange All rights reserved
doteasy.com - free web hosting. Free hosting with no banner.
Digg this page!

SUBSCRIBE