我在 BitBucket 上创建了一个新的空 git 存储库,现在我想将它链接到 Eclipse。
我将 repo 添加到“Git Repositories” View 并创建了一个同名的新项目。
我选择“团队 - > 共享项目”,然后提交并推送到上游。
现在我的存储库具有文件夹结构/my-long-project-name/My Long Project Name/
有什么办法可以让项目文件夹成为git仓库的根目录吗?
最佳答案
It is probably not a good idea to make a project the root folder of your Repository
The reason is that you will never be able to add another project to this Repository, as the .project file will occupy the root folder; you could still add projects as sub-folders, but this kind of project nesting is known to cause lots of problems all over the place. In order to add another project, you would have to move the project to a sub-folder in the Repository and add the second project as another sub-folder before you could commit this change.
我知道这不是解决方案,但至少这为不得不忍受具有相同名称的附加文件夹提供了正当理由。
(不推荐!)解决方法
创建/修改远程存储库,然后克隆到一个新的本地项目 :
如果你还没有开始开发或者有能力将重复子文件夹的内容(在你的例子中,“我的长项目名称”)移动到 git 存储库的根目录,你 可以 通过相反的方式避免以两次相同的文件夹结束:
.project
根文件夹中的文件,即已经是 Eclipse 项目一部分的文件,选择 “导入现有项目”并选择根文件夹,然后观看 Eclipse 发挥它的魔力。 免责声明:我个人决定不使用这种解决方法并坚持使用 EGit 建议。
关于eclipse - Egit 将 Eclipse 项目文件夹添加到 git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15425640/