Search code examples
gitgitignore

.gitignore does not ignore one folder


I've got the following in my .gitignore:

#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
# Windows thumbnail db
Thumbs.db
# OSX files
.DS_Store
# Eclipse project files
.classpath
.project
# Android Studio
.idea
build/
cache.properties.lock
.idea/workspace.xml
*.iws
.gradle/
**/.gradle/

However, whenever I make changes to my app, git includes files like .gradle/1.12/taskArtifacts/cache.properties.lock to the commit.

What's wrong here? Why does it work with the folder build/ but not with .gradle/?


Solution

  • It is possible that Git is already tracking these files. Running the following command in terminal worked for me for both .gradle and .idea files:

    git rm --cached .gradle -r