git - How do I set up Eclipse/EGit with GitHub? - Stack Overflow
Importing a GitHub project into Eclipse - Stack Overflow
How do I use github with eclipse to collaborate with other programmers?
java - how run application from github in eclipse - Stack Overflow
Videos
Make sure your refs for pushing are correct. This tutorial is pretty great, right from the documentation:
http://wiki.eclipse.org/EGit/User_Guide#GitHub_Tutorial
You can clone directly from GitHub, you choose where you clone that repository. And when you import that repository to Eclipse, you choose what refspec to push into upstream.
Click on the Git Repository workspace view, and make sure your remote refs are valid. Make sure you are pointing to the right local branch and pushing to the correct remote branch.
In Eclipse, go to Help -> Install New Software -> Add -> Name: any name like egit; Location: http://download.eclipse.org/egit/updates -> Okay. Now Search for egit in Work with and select all the check boxes and press Next till finish.
File -> Import -> search Git and select "Projects from Git" -> Clone URI. In the URI, paste the HTTPS URL of the repository (the one with .git extension). -> Next ->It will show all the branches "Next" -> Local Destination "Next" -> "Import as a general project" -> Next till finish.
You can refer to this Youtube tutorial: https://www.youtube.com/watch?v=ptK9-CNms98
As mentioned in Alain Beauvois's answer, and now (Q4 2013) better explained in
- Eclipse for GitHub
- EGit 3.x manual (section "Starting from existing Git Repositories")
- Eclipse with GitHub
- EGit tutorial
Copy the URL from GitHub and select in Eclipse from the menu the
File → Import → Git → Projects from Git

If the Git repo isn't cloned yet:
In> order to checkout a remote project, you will have to clone its repository first.
Open the Eclipse Import wizard (e.g. File => Import), select Git => Projects from Git and click Next.
Select “URI” and click Next.
Now you will have to enter the repository’s location and connection data. Entering the URI will automatically fill some fields. Complete any other required fields and hit Next. If you use GitHub, you can copy the URI from the web page.
Select all branches you wish to clone and hit Next again.
Hit the Clone… button to open another wizard for cloning Git repositories.

Original answer (July 2011)
First, if your "Working Directory" is C:\Users, that is odd, since it would mean you have cloned the GitHub repo directly within C:\Users (i.e. you have a .git directory in C:\Users)
Usually, you would clone a GitHub repo in "any directory of your choice\theGitHubRepoName".
As described in the EGit user Manual page:
In any case (unless you create a "bare" Repository, but that's not discussed here), the new Repository is essentially a folder on the local hard disk which contains the "working directory" and the metadata folder.
The metadata folder is a dedicated child folder named ".git" and often referred to as ".git-folder". It contains the actual repository (i.e. the Commits, the References, the logs and such).The metadata folder is totally transparent to the Git client, while the working directory is used to expose the currently checked out Repository content as files for tools and editors.
Typically, if these files are to be used in Eclipse, they must be imported into the Eclipse workspace in one way or another. In order to do so, the easiest way would be to check in .project files from which the "Import Existing Projects" wizard can create the projects easily. Thus in most cases, the structure of a Repository containing Eclipse projects would look similar to something like this:
See also the Using EGit with Github section.
My working directory is now
c:\users\projectname\.git
You should have the content of that repo checked out in c:\users\projectname (in other words, you should have more than just the .git).
So then I try to import the project using the eclipse "import" option.
When I try to import selecting the option "Use the new projects wizard", the source code is not imported.
That is normal.
If I import selecting the option "Import as general project" the source code is imported but the created project created by Eclipse is not a java project.
Again normal.
When selecting the option "Use the new projects wizard" and creating a new java project using the wizard should'nt the code be automatically imported ?
No, that would only create an empty project.
If that project is created in c:\users\projectname, you can then declare the eisting source directory in that project.
Since it is defined in the same working directory than the Git repo, that project should then appear as "versioned".
You could also use the "Import existing project" option, if your GitHub repo had versioned the .project and .classpath file, but that may not be the case here.
With the last ADT, you can import Github project using Eclipse :
File -> Import -> Git -> Projects From Git > URI
Enter the Github repository url
Select the branch
A couple of classmate and I will be working on a project for the end of the term together. One classmate created a repository for the project and we would like to collaborate over github. He created a repository and we were both able to pull the project into eclipse. How do we make it so that we can all make changes to the source code repository using eclipse? What kind of documentation do I need to read to figure this out? The idea is to push updates to the repository so that we can all see any changes made.
Edit: Just wanted to provide the resources I read to learn git in case anyone else having the same problem stumbles upon my post. Hope it helps.
I used these two resources from github:
-
https://github.com/git-guides
-
https://training.github.com/downloads/github-git-cheat-sheet/
You can follow this user guide section of git push (to a GitHub repo), adding a remote with the ssh address of your GitHub repo:

See also this tutorial to push your local project to that GitHub repo.
- Go to github create new repository
- Copy http URL from github
- Go to Eclipse --> Right click on project --> Team--> share project--> Create new Git Repo.
- Go to Git Staging--> add to index --> commit and push
- Right click on Git Repositories push to up stream
- Paste your http URL of githun which you copy in step 2
- Enter username and password of github -- > Finish