Ignore . classpath and . project on Github

Asked

Viewed 1,896 times

4

I can’t ignore the . classpath and . project files on Github. These are already in my . gitignore but after a while always end up coming back. I’m using Eclipse + Egit.

Follow my file . gitignore

/bin
/null
/.settings

*.db
*.class
*.jar
*.war
*.ear
.classpath
/.settings/org.eclipse.jdt.core.prefs
.project
/null/Documentos/indice-lucene/write.lock
/config.properties
  • sempre acabam voltando, that is, initially you can ignore them?

  • 1

    Because you didn’t use the same pattern as the other ignored extensions, i.e., *.classpath and *.project?

  • At first yes, I delete the files and keep on committing, after some time they are there again. @Miguelangelo used, but changed to see if it solved the problem.

  • Are there other people working on the same project? And the file .gitignore is being commissioned?

  • No, just me. Yes, it is.

  • Are you using a versioning program, like Gitextensions, Tortoisegit, or is it pure git? It’s in windows?

  • Yes, I’m using Windows + Eclipse + Egit

  • When git is "automatically changed" the file .gitignore is as if you had commiting changes?

  • Another thing, the .classpath and the .project were ever committed?

  • Yes, they were committed in the first commit, but then I fixed in . gitignore and deleted the files.

Show 5 more comments

1 answer

1


Assuming you accidentally committed the files .classpath and .project they will continue to be tracked regardless of the file .gitignore. If that’s the case do the following:

git rm --cached .project
git rm --cached .classpath

Fix your file .gitignore, execute the commit and update your project. The files .classpath and .project must stop being tracked.


Source: https://help.github.com/articles/ignoring-files

  • I’ve tried that, I think it’s some problem in Eclipse or Egit. I switched the IDE to Intellij and now I have no more problems with "garbage" being thrown into git.

  • Intellij is awesome! Still I can’t reproduce your problem in Eclipse (Kepler SR2). There’s something (plugin, bugle in your combination of Egit and bridge with Git, etc) making the problem happen.

  • If you can make a small repository on Github and a zip of the local project that is giving problem I can take a look, or else you open a bug directly for the Eclipse people: https://bugs.eclipse.org/bugs// (but only open if you are 100% sure that you can play in a clean current installation).

  • Ah, one thing... I don’t know if I have interpreted your question correctly. If the files .classpath and .project are only appearing on your machine this is normal behavior (the IDE will keep recreating the files), what cannot happen is these files keep being tracked.

  • Unfortunately I ended up giving up the Eclipse and changed from IDE. But I think it’s a bug in Egit, because I even made the initial commit and these files went up together, then added them to . gitignore and deleted from git. But after a few pushes they went back there.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.