Adding org.eclipse.core.resources.prefs
will work. However, I'm guessing that you committed the files to your repository already. .gitignore will not ignore files that have already been committed. So, you need to:
- remove all
org.eclipse.core.resources.prefs
files from the repo - add line to gitignore
- commit gitignore
And all of your prefs files will be ignored afterwards.