Setting up Eclipse for GitHub

A quick guide for setting up Eclipse and github. The "Git for Windows" client was not installed.
Prerequisites:
Eclipse Version:Eclipse IDE for Java EE Developers, Indigo Service Release 1

Create a Github account

Visit http://github.com/plans to sign up
Select your plan type

Updating Eclipse git plugin

Click Help-Eclipse Marketplace
Search for GIT
Click install on "EGit"
Follow the prompts to install

Setup Eclipse SSH

Eclipse has ssh key management options
Open Eclipse Windows\Preferences
     General\Network Connections\SSH2
     or
     Type "ssh" into the preference filter
Open the "Key Management" tab.
Click "Generate DSA key".
Click "Save Private Key"
Click "OK" to ignore the warnings
Click "Save" with the "default location" to store the keys in your ssh directory
Not this location
Your ssh keys setup is complete in Eclipse
Go to the location where the keys where saved
Default:"C:\Documents and Settings\{Your username}\ssh"
Open the .pub key file
Copy the key contents into the clipboard
Ensure you are logged into github.com
Click "Account Settings"
Click "SSH Public Keys"
Click "Add another public key"
Enter a "Title"
Paste the contents of the clipboard in the the "Key" field
Click Add Key

Create a github Repository

From the github "Dashboard" click "New Repository"
Enter your "Project Name"
Click "Create Repository"
You will be provided with some setup information.
Leave this page open as you will need it in a few moments

Share your Eclipse Project

Create a "Java Project" in Eclipse
Right click on the project, "Team\Share" Project
Select git
Click "Create"
Accept the default "Parent Directory"
Enter a "Name", for example "JavaProject"
Click Finish
Create at least one file in the project, for example a "README.txt"
Right click on the project, select "Team\Add"
Right click on the project, select "Team\Commit"
Enter a commit comment, click commit
Right click on the project, select "Team\Remote\Push"
In the dialog that appears, empty out the username field
In the protocol field, select git
Paste the information provided from the "Create Repository" step above
Example:
URI:git@github.com:{your git username}/JavaProject.git
Host:github.com
Repository path:{your user name}/JavaProject.git
Protocol:git
Click "Next"
Select "Add All Branches Spec"
Click "Finish"
Click "Ok" on the Push Results dialog

Confirm your push to github
Go back to github.com and select the "Java Project" Repository
Browse to see your committed files
Click on the "ReadMe.txt" to view its contents

Hope this helps!

Resources:
http://help.github.com/win-set-up-git/
http://www.eclipse.org/downloads/

Comments

Popular posts from this blog

Setting up SVN on Apache on Windows

Jenkins - Adding Build Lights - Delcom 904008

SVN to Hudson/Jenkins - Repository Hooks