Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Git gitignore file is ignored

I have an Android project in which I wish GIT to ignore the bin and gen folders. Therefore, I have placed in the directory of the project (I have also tried it at a level higher) the following .gitignore file:

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

# Local configuration file (sdk path, etc)
local.properties

# Eclipse project files
#.classpath
#.project

Unfortunately, this file is being ignored by Eclipse and I keep committing .class files and files from both gen/ and bin/. I have also tried to mark the folders as "Assume unchanged" but that also does not help.

I am not sure, but it is possible that I have added the file AFTER the first commit.

like image 469
checklist Avatar asked Sep 17 '13 13:09

checklist


People also ask

Why is git ignoring my Gitignore?

Some times, even if you haven't added some files to the repository, git seems to monitor them even after you add them to the . gitignore file. This is a caching issue that can occur and to fix it, you need to clear your cache.

Where do I put Gitignore in eclipse?

class files. Create a . gitignore file in the top-level folder of your Git repository.


1 Answers

Seems like you have already added and committed the gen and bin directories. .gitignore works only for untracked files and the purpose of it is to ensure purportedly untracked files remain untracked. To stop tracking bin and gen:

git rm -r --cached bin gen
git commit -m "removed generated files"
like image 90
laalto Avatar answered Sep 21 '22 19:09

laalto