I've imported a GitHub project but how do I setup the project in my Eclipse project workspace?
Do I need to set the GitHub working directory(c:\users) to my Eclipse working directory(c:\Projects) prior to checking out the project ?
Edited :
My working directory is now c:\users\projectname\.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, 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. 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 ?
When the local git projects are cloned in eclipse and are viewable in
git
perspective but not inpackage explorer
(workspace), the following steps worked for me:git
perspectiveimport projects
As mentioned in Alain Beauvois's answer, and now (Q4 2013) better explained in
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
), selectGit => Projects
from Git and clickNext
.Select “
URI
” and clickNext
.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.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 inC:\Users
)Usually, you would clone a GitHub repo in "
any directory of your choice\theGitHubRepoName
".As described in the EGit user Manual page:
See also the Using EGit with Github section.
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
).That is normal.
Again normal.
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.I think you need to create a branch before you can import into your local Eclipse, otherwise, there is an error leading to incapable of importing repository from Github or Bitbucket.
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
It can be done in two ways:
1.Use clone Git
2.You can set it up manually by rearranging folders given in it. make a two separate folder 'src' and 'res' and place appropriate classes and xml file given by library. and then import project from eclipse and make it as library, that's it.
I encountered the same problem, and finally found a way:
Ecplise Version: Mars.2 Release (4.5.2)