Integrate Git with Eclipse: Go Team Go!

One of the most interesting thing to do for a programmer whether he is student or professional is to team up with other guys in school/college/work and create a project. That’s the real fun.

Now you gathered a team, where’s the venue? That’s where Git comes. It provides a fully featured code sharing environment making our life way more easier.

While knowing Git commands might be helpful… there is no necessity.

Make way for GitHub

So without knowing the commands, how can we manage them? Say hi, to our guy : GitHub

GitHub provides all the frontened to manage the operations in Git. Now, I am not going to dive deep into GitHub, for the sake of keeping this instructive simple. Just create a account there and we are good to go. Don’t forget to verify your email address.


Goto Control Panel->System->Advanced System Settings->Environment Variales

  1. In the User variables section, if there is already a HOME variable…just leave him alone and skip these 3 steps
  2. or else click “New
  3.   Enter Variable name: HOME
  4. And Variable value: <path to your Home folder>. (e.g) C:/Users/Home –> where Home is the name of your User Account.


Next thing you have to do is to install Eclipse. If you already have one, make sure you have the latest version installed.

Here comes the hard part (not really…)

Open Eclipse, create a project or open existing project which you want share.

Goto Window->Prefernces->General->Network Connecion->SSH2->Key Management

  1. Click “Generate DSA Key…“. The text area below this button gets crowded
  2. Copy that key for now.
  3. And finally click “Save Private Key…“. Save anywhere you want and click “OK

You have to deal with two reposotories for the same project, one is the local repository(you have it with you) and the other is the remote repository(which is on the web). And they are not automatically synchronized. So, we have our local copy here, lets update it to the servers.

To make our local project a local repository,

Select the project you want to share, right-click->Team->Share Project

  1. Select Git and click “Next
  2. Create Repository if you have none or you ccan select from the existing repositories and click “Finish

Now, you can see your project gets associated with EGit. But you will see “[NO HEAD]” kind of description.

To resolve this, goto right-click the project->Team->Commit…

  1. First time you’ll make a commit, it will ask for a username and e-mail(GitHub credentials obviously), enter them and click “OK
  2. Enter any text in commit message
  3. select the files you want upload
  4. and finally click “Commit and Upload

To view the repositories,

Goto Window->Show View->Other->Git->Git Repositories

In the Git Repositories menu,

  1. Select the Remote Folder ->right-click->Creaet Remote
  2. Enter Remote name something like “origin” and click “OK
  3. This will get you into GitHub settings page(in Eclipse).
  4. Now goto your GitHub account Settings(in Webpage)->SSH and GPG keys->New SSH Key
  5. Enter the Title(any name actually…) and the Key from which we acquired from Ecllipse(the one I told you to copy before)
  6. Save the key and copy your page URL(which is the URL shown when you sign in)
  7. Press the “Change” option in GitHub settings page(in Eclipse).
  8. Enter the URL you copied and change protocol to “ssh”
  9. Click “Finish“, It’ll ask you to set a password(I leave this option to you)
  10. Finally, click “Save and Push

To Commit…

Open Eclipse, right click the project you want to commit(a fancy name for upload) and then select Team->Commit… or use the shortcut Ctrl + #

The changes you have made should be entered in Commit message which shows others the changes you have done.

Click “Commit and Option” to upload the files and sync the local repository with server or click “Commit” to inform others that you’re working on the selected files.

That’s all there is to it… Happy Coding!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s