How to config gitignore?

git, github, gitignore

Solution

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.

Problem

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?

Original source