add database.yml to .gitignore

In the autogenerated .gitignore file (rails source =, database.yml is NOT git ignored.

I’d suggest

  1. add “config/database.yml” to the .gitignore .gitignore.

  2. keep generated “config/database.yml” the exact same - no change.

  3. generate a new file, “config/database.yml.sample”, which would be presumably version controlled.

Also inlcude simple explanation for presence of database.yml/database.yml.sample, and strongly suggest not version controller actual database.yml.

If this sounds good, I’ll PR the code.

This has been suggested (and rejected) several times before. Most recently:!topic/rubyonrails-core/7HB0wdRzfVE

This has been discussed a few times in the past.

Whether having database.yml in the repo is a risk or not depends on
the context of the team, and indeed many people leave it in the repo
because it is OK for them. On another hand, we want to generate new
applications that just run, that's why the default database is SQLite.

Teams that want that .sample indirection can just implement it.