如何配置gitignore?

use*_*717 8 git github gitignore

我想忽略我的一些文件(/config/environments/production.rb,/webrat.log,/config/database.yml).我的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
Run Code Online (Sandbox Code Playgroud)

但这不起作用.怎么了?

vin*_*hew 9

你做的是对的.在制作.gitignore之前,你可能已经添加了这些文件.

试试吧

git rm -r --cached .   (Note the period at the end.)
git add .
Run Code Online (Sandbox Code Playgroud)

然后检查您放入忽略的文件是否仍添加到索引中.或者您可以修改它们并检查它们是否被跟踪.