Sunday, 25 August 2013

Configure Assembla GIT repository in eclipse (Windows)

Today I found out that setting up eclipse on a Windows system to connect to an Assembla GIT repo is not really straightforward. I'll try to guide you step-by-step to the environment set up, I take for granted that you have already created your Assembla project and that you've already have your eclipse project in a local GIT repository that you want to push on Assembla.

Key generation

First of all you have to generate a pair of private/public keys. You can do this from inside eclipse going in "Windows>Preferences>General>Network Connections>SSH2". Select the tab "Key Management" and then "Generate RSA Key...".

This will create a pair of public/private keys to be used for SSH. Now, without choosing a passphrase, save the private key on your PC in the directory "C:/Users/<Username>/.ssh" (Unless you have changed eclipse defaults stated in the SSH2 "General" tab). Copy to clipoard the public key string as it is in the text box, you'll need it to configure Assembla.
Select "Apply" and close the dialog with "OK".

Assembla configuration

Open your Assembla profile page and go to the tab "Manage SSH Keys". Here paste the public key you have copied before and add it with the "Add" button.

Now go to your project page and select the "Git" tab, Assembla should give you the repository url. Something like that:<project-name>.git, copy it in the clipboard, you'll need it to configure eclipse.

Remote repository creation

Return to eclipse and go to the GIT Repository Exploring perspective, select your local GIT repository and right click on the "Remotes", and select "Create Remote...".

Select the remote name and then go on, "origin" is the default. Eclipse will ask you to cofigure the push settings.

Select "Change..." near the URI field. Eclipse will show you a new dialog.

Paste the address you have copied from Assembla in the URI field, select SSH protocol and leave "git" as username. Confirm and close all the dialogs, if you select "Save and Push" your project will automatically be pushed to Assembla, otherwise you can do it later manually.

You should now be able to work with your Assembla GIT repository.
Let me know if this works for you also.

Note: Tested with eclipse Juno and EGit 2.3.1