How do I ignore this Eclipse file in Git? - eclipse

I tried adding it to my global .gitignore but it is still showing up as an untracked file when I do git status.
researchProject/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator (4).launch
I disabled the JavaScript validator because it kept giving my build errors -- the only solution I found was to disable it.

add the following lines to your .gitignore file:
.project
.settings
.classpath
.metadata
and for your case also
.externalToolBuilders
and you should be good to go.
Do not add .project and .classpath to .gitignore if you are working on an eclipse-specific project.

Related

How can I prevent eclipse from randomly adding .gitignore files everywhere?

eclipse keeps adding .gitignore files to my project that contain the following random list of files:
Thumbs.db
.DS_Store
.gradle
build/
out/
.idea
*.iml
*.ipr
*.iws
.project
.settings
.classpath
/bin/
I know which files I want to keep out of source control. I don't need my IDE to try to second guess me.
Where is the configuration option in eclipse that prevents it from creating .gitignore files.
I mentioned before (2014) the setting "Window → Preferences → Team → Git → Projects → Automatically ignore derived resources"
See if that would still have an incidence in your case (with, I presume, a much more recent Eclipse version)
This was also described (more recently, in 2020) in "Eclipse: Prevent creation of .gitignore for generated code" from Thomas Trocha

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?
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,
.metadata/.plugins
.metadata/.lock
.metadata/.log
and then for each project, the bin folder
project_dir/bin
and any other generated files

A folder is mysteriously added into my .gitignore file

I have an Eclipse project which contains only a single folder "MyFolder" containing a LaTeX file "myfile.tex". For some reason, whenever I refresh the project or save a file, the following line is added to the .gitignore file at the root of my project:
/MyFolder
I.e., someone mysteriously tells GIT to ignore the entire folder which contains my tex file. I suspect it's the tex plugin doing this. But why? How can I prevent this?
Try to:
Team → Git → Projects and unmark:
"Automatically ignore derived resources by adding them to .gitignore".

Ignore .classpath file while sync CVS in eclipse

I know that you can ignore the file (preference-team-ignore resources) type while committing to CVS from eclipse however how can I ignore the file type being synchronized with CVS. I have got 40 project in workspeace and every time I sync with CVS, it list all the .classpath files from all the project however I would like to ignore this file to make CVS sync view better.
any help will be appreciated.
Cheers
You can add the .classpath file to the .cvsignore file. In Eclipse, you should be able to right click on the .classpath file and go to Team -> Add to .cvsignore. Here are some additional details.

Git overriding .project file in eclipse

This is is a simple question. When I switch between branches my eclipse files get deleted in my project because they are not in my repository. .gitignore only works when checking in, not when switching branches. How can I keep my .project files in my project filed while using git?
Thanks
If a .project file was committed to the repository before it was added to .gitignore, it won't be ignored. You need to remove it from the repository. Since you probably want to keep it in your working tree, try this:
git rm --cached .project