Just realized that I need to add db.sqlite3 to gitignore file

I just found out that I should not be commiting and pushing my sqlite3 database my github repository. My website is already live and I’ve made many push and pull calls between local and production servers.
The answers I found on stackoverflow suggest I run git rm --cached db.sqlite then add it to the gitignore.
Is this the right way and also I want to know the implications of doing this to my production database. Will I now have to re create all the objects in my models (user accounts, images, blog posts,etc) in the production server?

Yes, git rm --cached db.sqlite3 is the way to remove the database from source control. It’s a good idea in general to keep the production database isolated from your development environment. If you need test data locally to develop features, there’s a couple of ways to populate that part of the database.

-Jorge

1 Like