gitignore for folder of eclipse projects

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?

  • Is it a good practise to do version control from outside the IDE?
  • How to make Eclipse recognise a Git source tree that was a Bazaar source tree
  • svn command line from eclipse
  • Git won't stop tracking eclipse java .recommenders
  • How to find and restore one single file from git?
  • Project lost when pushing to github from Eclipse
  • git plugin in Jenkins on Windows does not use credentials with submodule
  • Does git rebase create more conflicts than git merge?
  • How to push Tag to Bitbucket Git Repository in Bamboo from Cake build task?
  • git - skipping specific commits when merging
  • How can I cut down a git bisect run using file paths?
  • Git subtree - subtree up-to-date but can't push
  • 2 Solutions collect form web for “gitignore for folder of eclipse projects”

    If you want to have all of your Eclipse project data across your machines, you will have to add the following files/folders to Git:

    • .classpath
    • .project
    • .settings (folder)

    Make sure that these are not ignored in either your local or globale .gitignore files.

    Ignore things like the bin and target folders, since they contain the compiled classes and shouldn’t be added to Git.

    Regarding the failed import: as @nwinkler writes, Eclipse looks for the .project and .classpath files so you need to add them (and the .settings directory) to your git repository.

    Regarding .gitignore, I typically put the workspace stuff there (and then do import existing projects in eclipse after cloning):

    That is,


    and then for each project, the bin folder


    and any other generated files

    Git Baby is a git and github fan, let's start git clone.