2

I am working following a set of java swing tutorials, each is an Eclipse project, keep them in a workspace. I init a git repository in the workspace folder (mac), and upload to github. When I download this folder in another computer (linux), the projects are not recognized as such, and opening/importing in Eclipse fails. Says: 'Folder not recognized as project'. What is the best way to handle a collection of projects in git?

4

2 回答 2

2

如果您想在您的机器上拥有所有 Eclipse 项目数据,您必须将以下文件/文件夹添加到 Git:

  • .classpath
  • 。项目
  • .settings(文件夹)

确保这些在您的本地或全局.gitignore文件中都不会被忽略。

bin忽略和文件夹之类的东西target,因为它们包含已编译的类,不应该添加到 Git 中。

于 2015-06-16T10:34:22.900 回答
1

关于失败的导入:正如@nwinkler 所写,Eclipse 寻找.projectand 。classpath文件,因此您需要将它们(和.settings目录)添加到您的 git 存储库中。

关于.gitignore,我通常将工作区的东西放在那里(然后import existing projects在克隆后在 eclipse 中做):

那是,

.metadata/.plugins
.metadata/.lock
.metadata/.log

然后对于每个项目, bin 文件夹

project_dir/bin

和任何其他生成的文件

于 2015-06-16T10:36:35.720 回答