本文介绍了Egit将Eclipse项目文件夹添加到git仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在BitBucket上创建了一个新的git存储库,现在我想把它链接到Eclipse。



我把这个回购添加到了Git Repositories视图并创建了一个名称相同的新项目。



我选择Team - > Share Project,然后提交并向上推。



现在我的存储库有文件夹结构/ my-long-project-name /我的长项目名称/



有没有办法让项目文件夹git存储库的根?

解决方案

从:

I know this is not a solution, but at least this gives a valid reason for having to endure the additional folder with the same name.


The (not recommended !) workaround

Create/modify the remote repository, then clone into a new local project:

If you haven't started developing yet or can afford to move the contents of the duplicate sub-folder (in your case, "My Long Project Name") to the root of the git repository, you can avoid ending up with twice the same folder, by going the other way around:

  1. Move the files within the project to the root of the remote repository / Create the remote repository if this is a new project.

  2. In the "Git Repositories" view in Eclipse, find the "Clone a Git repository and add the clone to this view". Follow the steps to clone your repository from your URI to a local folder.

  3. In the same view, right-click the repository in the list and choose "Import Projects..."

    • If you have a .project file in the root folder, i.e. the files where already part of an Eclipse project, choose "Import existing projects" and choose the root folder, then watch Eclipse do its magic.

    • If this is a new project (or the files on the origin are not an eclipse project), choose "Import as general project", then modify the project type in Eclipse afterwards if you need a specific project type.

Disclaimer: I personally decided not to use this workaround and to stick with the EGit recommandations.

这篇关于Egit将Eclipse项目文件夹添加到git仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 01:30
查看更多