setting up eclipse with github

For most of the project I use eclipse as it is very extendable with so many plugins but when I want to be lazy and let the IDE do everything I wish I use Netbeans (i.e at work :)). I wanted my project to be stored as repository at git and let eclipse handle all the source controlling jobs , so that I do not have to use shell or git bash for committing and pushing the local changed to remote  repository everytime. I managed to connect my repository in github to my eclipse project in the following way

1. Download and Install EGit eclipse plugin into your eclipse.

2. Copy the HTTP url from your github project. Here  is how to create a github repository



3. In Eclipse click on File-> Import and select "Projects from Git" under the the Git folder. On clicking next you might get a dialoge for Home environment variable not being set but you can ignore and click on OK.

4.Click on clone and paste the URL copied in step 2 and click next.

5. You will be asked for branch section, in my case I selected master and click next.

6.Then you will be asked to configure the local destination . You can give the a project directory iside your eclipse workspace.

7.Upon clicking next , You might get a message for master password recovery hint question.

8. Cancel the new project from git wizard and create a project from the existing source. Select the folder which we had given as the local destination in step 6.

9.Right click on the newly create project and click on "Team" -- > "Share Project". You can ignore the home environment variable dialog again and  select "git" in the share project window.

10.click next and check the "use or create repository in the parent folder of project" checkbox. Check the newly create git repository folder and click finish.



11. Now you will see the project folder icon is changed and small yellow cylinder icon has appeared next to all files and folder in the hierarchy of  the project which denotes that these are now version controlled.

Source control operations from Eclipse

After code changes you can right  click on any file or folder in the project hierarchy and click  " Team --> Commit " to commit the changes locally and finally right click on the project node and "Team -> Push to Upstream" for pushing the changes to the github server(remote)  repository

More documentation can be found at the EGit Documentation page. Also see setting up the Git