I have just spent a lunchtime trying to get EGit (Git plugin for Eclipse) to work with my Git repository that is hosted on Unfuddle.com.
It wasn’t too difficult once I worked out what to do, but just in case anyone else needs to know here is how I did it:
Firstly I added EGit to Eclipse from the Help –> Install New Software menu option in Eclipse. I had to add the site to Eclipse with the following address: http://download.eclipse.org/egit/updates. I was then able to install the packages without a problem.
Now, the tricky bit for me to work out was how to setup the SSH part of the system. I created the repository and worked on the code initially using Eclipse on Ubuntu with EGit installed. That system worked out of the box, all I had to do was add the Public key from Ubuntu to my Unfuddle account. With Windows I was getting ‘Auth Fail’ messages when I tried the same. There are some extra steps to go through, or at least I had to, to get the SSH bit working.
By going to Window –> Preferences and then General –> Network Connections –> SSH2 I was able to setup Eclipse to point to the directory that I already use to hold my SSH keys. By default Eclipse was using an ssh directory in the root of my Windows User folder, I needed to change this to .ssh to point to my existing keys (I have Git installed through MsysGit so have already generated keys to talk to Unfuddle).
With this done I could import my project from Unfuddle. Previously I had tried using the Git command line tool on Windows to clone a copy of the repository and then try to open it in Eclipse, this proved problematic as it seemed to be missing some files that Eclipse needed for the project. Hence the reason for setting up EGit.
Within the project window of Eclipse I right-clicked and then selected Import… From the next menu I selected Git –> Projects from Git, and on the second screen I wanted to Clone a repository. I added my Unfuddle repository URL plus the path to the actual repository I wanted to clone. I set the protocol to git+ssh and then the User to be git. This was a bit of trial and error to workout how to construct the URI string for the connection.
Hitting Next will force EGit to go and get a list of the branches for the repository you entered. If you receive an error message then the chances are you either entered the repository information incorrectly for your Unfuddle account or you don’t have the SSH keys setup correctly for Unfuddle to verify you are who you say you are.
With the correct branch selected I was then asked where to put the files on my local HDD and what I wanted to call the remote connection to the Unfuddle server. Clicking finish showed the newly setup repository in the repository list.
I selected the new repository and then Next. If your repository contains existing Eclipse projects then you can choose to import them (mine does so that is what I am doing), tick the boxes next to the projects to be imported.
Clicking Finish made EGit bring all the files down from the Unfuddle servers. Assuming everything was checked in and pushed up correctly from whoever worked on the project last, it should build and run without a problem, mine did!