Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git is not using the contents of .gitignore

I’m working with Rails and added the directory tmp and the Gemfile to my .gitignore. But every time I change it, git status tells me, that it changed. On both machines. On my developer machine and on the server. Kind of annoying.

Contents of .gitignore:

.DS_Store
data/export/*.csv
tmp/*
*.rbc
*.sassc
.sass-cache
capybara-*.html
.rspec
/.bundle 
/vendor/bundle 
/log/* 
/tmp/* 
/db/*.sqlite3 
/public/system/* 
/coverage/ 
/spec/tmp/* 
**.orig 
config/*.yml 
rerun.txt 
pickle-email-*.html 
Gemfile*
like image 847
Ulf Klose Avatar asked Dec 05 '22 22:12

Ulf Klose


1 Answers

It could be that git is already tracking the files. Try git rming them:

git rm --cached Gemfile

(although you probably should have the Gemfile under version control)

and for the tmp dir:

git rm -r --cached tmp

the --cached is so that the working file will not be deleted, and -r is to recursively remove from a directory.

After this git should respect .gitignore.

like image 142
matt Avatar answered Dec 27 '22 20:12

matt