Here’s the problem: I’m developing a few projects that need to somehow store credentials used for external services – for example, an e-mail address and password. I figured it falls into “configuration” and decided to move the variable data into a separate file the program reads from. I don’t want this file to be pushed to upstream though, because in some of my smaller programs, written for personal needs, I test on a production environment and the data are usually quite sensitive.
On the other hand, I don’t want a basic .gitignore solution or its equivalent – instead of not uploading the file at all, I’d prefer to send another file in its place, an example configuration file, while keeping the “real” file on its place on my computer. Is there any simple way of achieving it?
If you need more details to answer the question, I’d prefer an answer regarding Git VCS, Python scripts and Linux OS.
One possible solution:
Commit and push a “sample” config file. Then, make the modifications you want to the local config file. It will now be marked as modified in Git.
Use
git update-index --assume-unchanged configto permanently ignore future local modifications to the config file (use--no-assume-unchangedto resume tracking modifications).This way, you will have a sample config in the upstream repo, a customized config in your repo, and you will not accidentally commit the changed config because Git will not mark it as modified.