How to clone a project from github and import in eclipse



This page will teach us how to clone a project from GitHub to your local repository and import in eclipse.

Prerequisites:
1.) Windows/Ubuntu with JDK6/7.
2.) eclipse (I'm using Juno) with egit, m2eclipse, m2e-egit plugin (from eclipse marketplace).

Guide:
1.) Find czetsuya in GitHub: https://github.com/czetsuya/czetsuya.

2.) Click HTTP and copy the url: https://github.com/czetsuya/czetsuya.git.

3.) Open eclipse.
a.) Click Windows->Show View->Git Repositories.
b.) Click Clone a Git repository.
c.) In your GitHub repository copy, Code->Http value for example: https://github.com/czetsuya/czetsuya.git.
d.) Back to eclipse, paste the git repo in the URI field.
e.) You can enter your username/password in Git, or click next to checkout read-only access.
f.) In the next screen, make sure that master is checked. Click next.
g.) Enter the directory where you want to store the local copy. Initial branch="master". Click "Clone submodules", and select a working set if you like.
h.) Click Finish.

4.) Now in your eclipse->Git repositories, you should be able to see the newly pulled copy of your repository from GitHub.

5.) It should have the following structure:
-git
-Branches
 -Local
  -..
 -Remote Tracking
  -..
-Tags
-References
 -..
-Remotes
 -..
-Working Directory
 -GitDemo
 -..

6.) In this example, I have a GitDemo maven project in my repository. So I'll right click on GitDemo->Import maven projects. You can add the project to your working set.

7.) Click next, finish.

8.) Now the project that you imported should appear in your eclipse's project explorer. Unfortunately it's not linked by default to the repository so we have to share it.

9.) So right click on the GitDemo project->Team->Share Project. Select Git, then next.

10.) In the next screen, the local GitDemo project should be checked. Click finish.

11.) You project should now be connected to your local Git repository.

{ 0 comments... read them below or add one }