Eclipse + EGit:将项目克隆到工作区 [英] Eclipse + EGit: clone project into workspace

查看:149
本文介绍了Eclipse + EGit:将项目克隆到工作区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对EGit的工作感到有些困惑。



我在Github上有一个现有的git存储库,并希望克隆到我的工作区。
我的目标是将本地存储库直接存储在我的工作空间文件夹中,但是我不能使用EGit。



当我想克隆与EGit的github回购,我必须选择一个目录作为目的地。建议的目录在我的homedir(不在我的工作区)。当我选择此目录时,我可以在Eclipse中看到该项目,但它不存储在我的workspace-folder中。相反,它存储在我的家庭目录中。



当我在工作区内直接选择一个目录时,稍后在导入项目时,它表示已经有一个名称为的目录。



我不知道如何解决这个问题。我以为这是一个常见的情况。在过去我已经使用hgEclipse(Mercurial),它的工作正是我认为应该是这样我困惑了EGit不。也许我误解了一些东西。



可能这是很重要的知道:在github存储库中没有.project或.settings文件从eclipse。我有他们在我的.gitignore,所以在import-dialog我必须选择导入为一般项目,而不是导入现有项目。但是我认为这并不重要?



我希望有人可以帮助我或解释一下,为什么EGit插件默认情况下不会将存储库直接克隆到工作区。



我的Eclipseversion是3.6,我已经在标记上安装了EGit。

解决方案

EGit教程所述,目标目录提及导入(克隆)Git repo是您想要的任何目录,其中将创建 .git





你不必须选择工作空间本身(至少应该选择 workspace / myproject 子目录,以便不使全部 Eclipse工作区为Git



您可以选择工作空间之外的任何其他目录:Eclipse工作区只应包含有关Eclipse项目和设置的元数据。

当声明一个新项目时,您将能够选择p roject目录,使目录为 .classpath .project 的父目录。

您的工作区将列出这个新项目,即使它位于工作区外。


I'm a little confused about how EGit workes.

I have an existing git repository on Github and want to clone it into my workspace. My goal is to have the local repository directly stored inside my workspace-folder but I don't get it working with EGit.

When I want to clone the github repo with EGit, I have to choose a directory as destination. The suggested directory is in my homedir (not in my workspace). When I choose this directory I can see the project in Eclipse but it is not stored in my workspace-folder. Instead it is stored in my home dir.

When I choose a directory directly inside my workspace, later when it comes to import the project it says that there is already a directory with this name.

I don't know how to solve this. I thought this would be a common scenario. In the past I have used hgEclipse (Mercurial) and it was working exactly the way I thought it should be so I'm confused EGit doesn't. Maybe I misunderstood something.

Probably this is important to know: In the github repository there are no .project or .settings files from eclipse. I have them on my .gitignore and so in the import-dialog I have to choose "Import as General Project" and not "Import Existing Projects". But I think this shouldn't matter?

I hope someone can help me or explain me why the EGit plugin doesn't clone the repository directly into the workspace by default.

My Eclipseversion is 3.6, I have installed EGit over the markedplace.

解决方案

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:

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.

这篇关于Eclipse + EGit:将项目克隆到工作区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆