Eclipse + EGit: clone project into workspace Eclipse + EGit: clone project into workspace git git

Eclipse + EGit: clone project into workspace


As mentioned in this EGit tutorial, the destination directory you mention when importing (cloning) a Git repo is any directory you want, in which the .git will be created:

Import Git Repository

You don't have to select the workspace itself (at least, you should select the workspace/myproject subdirectory, in order to not make the all Eclipse workspace a Git repo.

And you can select any other directory outside the workspace: the Eclipse workspace should only contain meta-data about Eclipse projects and settings.
When declaring a new project, you will be able to select the project directory, making that directory the parent for .classpath and .project.
Your workspace will list that new project, even though it lives outside the workspace.


To import a project from GitHub you should use the Import Git Repository as New Project dialogue (right click -> Import -> Git -> Git Repository as New Project). This way you can select the destination of the clone repository, including the Workspace.


If you want to edit the sources in the IDE and also want the changes to be reflected in the Git repository, delete the original source file in the project and link the source file in the git repo to the project. That way, you can directly make changes to the git repo and you can commit them when needed. Be careful not to delete the files when deleting the project in the IDE though.