git 更新后如何让 Eclipse/EGit 识别现有的存储库信息?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7194877/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How make Eclipse/EGit recognize existing repository information after update?
提问by tohuwawohu
After upgrading Eclipse from Helios to Indigo with EGit plugin 1.0.0, all my projects seem to have lost their metadata about their git repositories, respectively.
使用 EGit 插件 1.0.0 将 Eclipse 从 Helios 升级到 Indigo 后,我所有的项目似乎都分别丢失了有关其 git 存储库的元数据。
In Helios, every Eclipse project was a git repository on its own. When updating to Indigo, i hoped i could continue using the workspace from Helios. After the update, all projects are still present in the workspace; and in each project directory, there's still the .git
subdirectory, but Eclipse seems to treat each project as if it wasn't a git repository already.
在 Helios 中,每个 Eclipse 项目本身都是一个 git 存储库。更新到 Indigo 时,我希望我可以继续使用 Helios 的工作区。更新后,所有项目仍然存在于工作区中;在每个项目目录中,仍然有.git
子目录,但 Eclipse 似乎将每个项目视为已经不是一个 git 存储库。
So, there's still all git metadata in the project folders, but eclipse doesn't recognize them. Is there another way to "reactivate" the git functionality?
因此,项目文件夹中仍然存在所有 git 元数据,但 eclipse 无法识别它们。还有另一种“重新激活”git 功能的方法吗?
回答by tohuwawohu
Thanks to Jeremy, i found how to reactivate the repos myself. Basically, two steps were required:
感谢 Jeremy,我找到了如何自己重新激活 repos。基本上,需要两个步骤:
- Add the (already existing) local repository to EGit's
Git Repositories
view; - "Share" each of the projects again using "use or create repository".
- 将(已经存在的)本地存储库添加到 EGit 的
Git Repositories
视图中; - 使用“使用或创建存储库”再次“共享”每个项目。
The second step won't work if the repo isn't available in the repository view. So, after an eclipse upgrade, do the following:
如果 repo 在存储库视图中不可用,则第二步将不起作用。因此,在 Eclipse 升级之后,请执行以下操作:
Add the (already existing) local repository to EGit's Git Repositories
view
将(已经存在的)本地存储库添加到 EGit 的Git Repositories
视图中
- Open the
Git Repositories
view: - Hit the "add" button (Tooltip:
Add an existing local Git Repository to this view
) - In the "Add Git Repositories" dialogue, under
Search criteria
, enter the workspace directory, select "Look for nested repositores
", and hit Search: - Select the repositories you want to add and click OK
- 打开
Git Repositories
视图: - 点击“添加”按钮(提示:
Add an existing local Git Repository to this view
) - 在“添加 Git 存储库”对话框中,在 下
Search criteria
,进入工作区目录,选择“Look for nested repositores
”,然后点击Search: - 选择要添加的存储库并单击 OK
"Share" each of the projects again using "use or create repository"
使用“使用或创建存储库”再次“共享”每个项目
- Open you existing project in Eclipse's
Project explorer
; - Right-click and select "
Team
->Share Project...
": Select Git Project, and in the next dialogue, select "
Use or create Repository in parent folder of project
". Important: don't try to select the repository from the combo box that's visible when "Use or create Repository in parent folder of project
" isn't selected - it won't work.
- 在 Eclipse 中打开现有项目
Project explorer
; - 右键单击并选择“
Team
->Share Project...
”: 选择 Git Project,然后在下一个对话框中选择“
Use or create Repository in parent folder of project
”。重要提示:不要尝试Use or create Repository in parent folder of project
从未选择“ ”时可见的组合框中选择存储库- 它不会工作。
The wizard suggests the local git repository that's located in the current project, so just hit Finish.
向导会建议位于当前项目中的本地 git 存储库,因此只需点击Finish。
回答by Ivan
Even after adding git repos I cannot do Team/Share on project, but what helped was to close and open project- you can also select multiple projects so action is quick
即使在添加 git repos 之后,我也无法在项目上进行团队/共享,但是关闭和打开项目有帮助- 您还可以选择多个项目,以便快速采取行动
回答by S Kodama
In my case, the git repos existed but the team context did not show the "Share this project" option. It looked like the project was partially configured with git.
就我而言,git repos 存在,但团队上下文没有显示“共享此项目”选项。看起来该项目部分配置了 git。
I could fix the problem by deleting the project (without deleting the actual files) and then importing the project back to eclipse.
我可以通过删除项目(不删除实际文件)然后将项目导入回 eclipse 来解决问题。