如何从现有的 git 存储库创建 Eclipse 项目

发布于 2024-10-03 01:06:40 字数 270 浏览 4 评论 0原文

我有一个使用 git 的现有项目,并且刚刚安装了 eclipse 和 egit。我用 egit 指向 git 存储库,可以看到我的所有文件、现有分支,并且可以在分支之间切换。

当我从 git 存储库的视图中打开一个文件时,它似乎无法识别它是一个 php 文件,不会显示其中的类,也不会完成代码完成。如果我只是从资源管理器中拖入一个文件,它至少会将该文件识别为 php,但不能很好地理解该项目,无法向我显示已安装库的代码完成。我想我需要配置 eclipse 来了解项目主目录,但我有点迷失了。任何帮助将不胜感激。

I have an existing project utilizing git and have just installed eclipse along with egit. I pointed to the git repository with egit and can see all my files, my existing branches and can switch between branches.

When I open a file from the view of the git repository it does not seem to recognize that it is a php file, doesn't show me the classes within it and doesn't do code completion. If I just drag a file in from explorer it at least recognizes that file as php, but doesn't understand the project well enough to show me code completion from installed libraries. I think I need to configure eclipse to understand the projects home directory, but am a bit lost. Any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

绝不放开 2024-10-10 01:06:40

您的答案可能属于本指南的范围,以改变项目的“性质”。至少值得探索。我将在本周的某个时候尝试做你所描述的事情,希望它能奏效。维基文档还表明某些“性质”可能会相互冲突,但希望这里不会出现这种情况。链接-->
http://wiki.eclipse.org/IRC_FAQ#How_do_I_manually_assign_a_project_Nature_or_BuildCommand.3F

尝试之后重现你的步骤我有完全相同的经历。我相信这可能是“预期”的行为。为了清楚起见,当我从“PHP Explorer”视图打开 php 文件时,一切似乎都工作正常,但是当我从“Git Repositories”视图打开 php 文件时,Eclipse 将其视为文本文件(没有代码突出显示等)。我建议您从 PHP 资源管理器视图中工作,并单独打开 Git 存储库视图,仅用于观察/监视存储库,而不是作为要编辑的文件的工作视图等。

Your answer may fall within this guide to change the "nature" of your project. It's at least worth exploring. I will be attempting to do the exact thing you've described some time this week so hopefully it will work. The wiki doc also suggests that certain "natures" may conflict with each other but hopefully that won't be the case here. Link -->
http://wiki.eclipse.org/IRC_FAQ#How_do_I_manually_assign_a_project_Nature_or_BuildCommand.3F

After just trying to reproduce your steps I am having the exact same experience. I believe this may be "expected" behavior. For clarity, when I open a php file from the "PHP Explorer" view everything seems to work fine but when I open a php file from the "Git Repositories" view Eclipse treats it as a text file (no code highlighting etc.). I suggest that you work from the PHP Explorer view and leave the Git Repositories view open separately only to watch/monitor the repository not as a working view of files to edit and what not.

水染的天色ゝ 2024-10-10 01:06:40

您需要从现有源(GIT 工作文件夹)将其作为 PHP 项目打开,然后与 Git 共享该项目,即右键单击该项目,转到 Team >共享项目,单击 Git。

请参阅 http://www.youtube.com/watch?v=-Zba8iAnLms 了解一个演示。

You need to open it as a PHP Project from existing source (GIT working folder) then share the project with Git, ie, right-click on the project, go to Team > Share project, click on Git.

See http://www.youtube.com/watch?v=-Zba8iAnLms for a demo.

憧憬巴黎街头的黎明 2024-10-10 01:06:40

你在eclipse中安装了pdt插件吗?它应该识别任何打开的 .php 文件。它位于哪里应该不重要。

Did you install the pdt plugin in eclipse? It should recognize any .php file opened. Shouldn't matter where it's located.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文