I have a node.js project with .env file in it. I pushed to github project, when in .env file was just a template. For example:
# Database credentials
DB_HOST=""
DB_USER=""
DB_PASSWORD=""
DB_DATABASE_NAME=""
Then I added .env file to .gitignore. Pushed again and now, when I filled .env file with credentials, git status command says
modifed: .env
How can I store a template of .env file in github and ignore it's changes?
When we need to provide templates for environment files or secrets, we tend to add a .sample to the file name. That's has been mine and my workplace convention, and a lot of people follows it. So you can have files like
.env.sample and secrets.sample
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With