Posts .gitignore and database.yml in Rails
Post
Cancel

.gitignore and database.yml in Rails

Untrack database.yml file by adding it to .gitignore

How to

Case 1: database.yml file wasn’t already committed

1
2
3
4
5
$ echo config/database.yml >> .gitignore
$ mv config/database.yml config/database.yml.example
$ git add .
$ git commit -am "put database.yml to .gitignore and and rename"
$ cp config/database.yml.example config/database.yml

Case 2: database.yml file was already committed. After tell .gitignore the changes, run the following command and then commit

1
git rm --cached config/database.yml

References


“When you give joy to other people, you get more joy in return. You should give a good thought to happiness that you can give out.”— Eleanor Roosevelt

This post is licensed under CC BY 4.0 by the author.