Perry Horwich
Perry Horwich

Reputation: 2846

Why is config/database.yml included in the .gitignore file by default for my Rails app?

Why would config/database.yml be included in the .gitignore file by default? This small item cost me an hour or two.

The way I stumbled into this trouble:

Not sure why. Cost me an hour or so of fiddling with reset and merge options, when it turns out I wasn't even tracking the file. As I write this, I realize I am not entirely sure when .gitignore was written/modified to include config/database.yml

Is there some reason it should be there?

Upvotes: 3

Views: 1379

Answers (2)

Perry Horwich
Perry Horwich

Reputation: 2846

If you are seeing a file for which 'git reset' and 'git revert' don't seem to have any effect, you may find the file is listed in the .gitignore file in your project root.

Upvotes: -2

qqx
qqx

Reputation: 19475

That file usually won't contain much interesting content for tracking in a version control system.

But, it will often contain passwords for connecting to a database server, which should not be made public.

It will also often contain information which needs to differ between different working copies, different user or database names for a database server, different paths to a SQLite file. These differences would make it impossible to track this file in the version control system.

Upvotes: 5

Related Questions