Assume I have a project I'm working on that is a blog. In this blog I have a config file with sensitive information in it. When I decide to push this project to Github, I want the config file filled with example data instead of my sensitive data. What is the best, and most widely used, method of achieving this?
Don't put it there in the first place. Check in an example config file with a different name, add the real config file's name to .gitignore, and never check it in.
If you've already done commits with your config file in place, use git filter-branch to make it go away before you push anywhere public.
One possible approach is:
configure git to ignore changes in tracked file:
git update-index --assume-unchanged config-file
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