Eclipse Egit不会在工作区中导入repo(Eclipse Egit will not import repo in workspace)

编程入门 行业动态 更新时间:2024-10-22 22:50:39
Eclipse Egit不会在工作区中导入repo(Eclipse Egit will not import repo in workspace)

我正在尝试将现有的git存储库导入为eclipse项目。 存储库存储在〜/ src / repo_dir位置,〜/ src /是我的eclipse工作空间目录。

如果我使用菜单操作序列:

File --> Import --> Git --> Projects from Git --> Local --> (Select my repo) --> "Import as General Project"

我收到错误:

/Users/me/src/repo_dir overlaps the location of another project: 'repo_dir'

我无法导入该项目。 这似乎是因为Egit不希望导入的原始仓库已经在工作区中。 但是,如果我然后将repo_dir移出工作空间目录〜/ src /,然后通过上面的方法导入项目,它不会将内容复制到工作空间目录,所以现在我的文件存在于其他地方,这是不可取的。 我找到的唯一解决方法是将repo移出〜/ src,导入它,删除生成的项目,将repo移回〜/ src,然后使用git作为'Existing project'导入它。 有谁知道更清洁的方法来处理这个?

I am trying to import an existing git repository as an eclipse project. The repository is stored in the location ~/src/repo_dir, and ~/src/ is my eclipse workspace directory.

If I use the sequence of menu operations:

File --> Import --> Git --> Projects from Git --> Local --> (Select my repo) --> "Import as General Project"

I get the error:

/Users/me/src/repo_dir overlaps the location of another project: 'repo_dir'

and I can't import the project. It seems to be because Egit does not want the original repo that is being imported to already be in the workspace. However, if I then move the repo_dir out of the workspace directory ~/src/, and then import the project via the method above, it doesn't copy the contents to the workspace directory, so now my files live somewhere else, which is undesirable. The only workaround that I have found is to move the repo out of ~/src, import it, delete the resulting project, move the repo back into ~/src, and then import it with git as an 'Existing project.' Does anyone know of a cleaner way to handle this?

最满意答案

这里有两个不同的问题:

Git将计算机中的选定文件夹作为存储库处理 - 并在其中存储一些与git相关的元数据。 Eclipse将您计算机中的选定文件夹作为工作区处理。 它存储Eclipse配置文件(不打算共享),更糟糕的是,它期望项目的单级文件夹层次结构。

这意味着,在工作空间中放置一个Git存储库可能会导致许多不必要的问题 - 所以我不建议这样做(即使通过一些黑客它是可行的)。 但是,如果要组织与Eclipse工作区相关的所有内容,可以创建一个文件夹结构:

Eclipse的东西 工作区 混帐 混帐repo1 混帐repo2

工作空间文件夹作为工作空间文件夹提供给Eclipse,而git-repo1git-repo2是您的Git存储库。

另一方面,我喜欢把我所有的git存储库放到一个公共文件夹中,无论我使用它们的Eclipse工作区,但是如果你想组织内容,这对你来说可能还不够。

There are two different issues here:

Git handles a selected folder in your computer as a repository - and also stores some git-related metadata in it. Eclipse handles a selected folder in your computer as your workspace. It stores that Eclipse configuration files (not meant to be shared), and even worse, it expects a single-level folder hierarchy for projects.

This means, putting a Git repository inside the workspace might cause a lot of unwanted issues - so I do not recommend this way (even if by some hack it is workable). However, if you want to organize all stuff related to an Eclipse workspace, you could create a folder structure as this:

eclipse-stuff workspace git git-repo1 git-repo2

The workspace folder is given to Eclipse as the workspace folder, while git-repo1 and git-repo2 are your Git repositories.

On the other hand, I like to put all my git repositories into a common folder, regardless of the Eclipse workspace I use them in, but if you want to organize contents, this might not be enough for you.

更多推荐

本文发布于:2023-07-06 08:03:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1047643.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:会在   区中   工作   Egit   Eclipse

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!