Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git wont ignore /build/intermediates/ files even though I added build/ to .gitignore

I am doing android development in android studio and i'm trying to ignore all /build/ files but it isn't working. This is my current .gitignore file

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# built native files
*.o
*.so

# generated files
bin/
gen/

# Ignore gradle files
.gradle/
build/

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

# Proguard folder generated by Eclipse
proguard/

# Eclipse Metadata
.metadata/

# Mac OS X clutter
*.DS_Store

# Windows clutter
Thumbs.db

# Intellij IDEA (see https://intellij-support.jetbrains.com/entries/23393067)
.idea/workspace.xml
.idea/tasks.xml
.idea/datasources.xml
.idea/dataSources.ids

.*
!/.gitignore

but when I do a git status, build files still appear

like image 381
NathanWick Avatar asked Jun 29 '15 20:06

NathanWick


People also ask

Why is .gitignore not ignoring my files?

gitignore ignores only untracked files. Your files are marked as modified - meaning they were committed in the past, and git now tracks them. To ignore them, you first need to delete them, git rm them, commit and then ignore them.

Why does .gitignore not work?

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.

Does Git add ignore files in Gitignore?

gitignore file tells Git which files to ignore when committing your project to the GitHub repository. gitignore is located in the root directory of your repo. / will ignore directories with the name.

How do I force Git to ignore a file?

You can create a . gitignore file in your repository's root directory to tell Git which files and directories to ignore when you make a commit. To share the ignore rules with other users who clone the repository, commit the . gitignore file in to your repository.


1 Answers

Chances are they were added to the repo before they were added to the .gitignore file. You should remove them from the repo with git rm --cached filename.ext, and commit (along with the .gitignore file).

like image 195
David Deutsch Avatar answered Oct 09 '22 11:10

David Deutsch