Reputation: 789
I want to ignore some of my files (/config/environments/production.rb , /webrat.log , /config/database.yml ). My gitignore:
/.bundle
/db/*.sqlite3
/doc/
*.rbc
*.sassc
.sass-cache
capybara-*.html
.rspec
/vendor/bundle
/log/*
/tmp/*
/public/system/*
/coverage/
/spec/tmp/*
**.orig
rerun.txt
pickle-email-*.html
/config/environments/production.rb
/config/*.yml
/*.log
But this doesn't work. What's wrong?
Upvotes: 8
Views: 9962
Reputation: 1026
If "database.yml" got added to your git repo before you specified it in the ignore file, I think you have to remove it:
git rm config/database.yml
git commit -a -m "Removed database.yml"
Then, add database.yml file in your project, will work fine.
Upvotes: 1
Reputation: 4378
What you did is correct. Probably you have already added these files, before making .gitignore.
So Try this
git rm -r --cached . (Note the period at the end.)
git add .
Then check whether the files that you put in ignore is still added to the index. Or you could modify them and check whether they are being tracked.
Upvotes: 10
Reputation: 1324887
If those files were already added to the index, you need to remove them first.
git rm --cache /config/environments/production.rb
git rm --cache /webrat.log
git rm --cache /config/database.yml
Then the .gitignore
can work on those files.
Upvotes: 3