I have a file secret.yml which contains a few variables that should be kept secret:
token: SUPER-SECRET-TOKEN
another_secret_variable: abcdef
how can i make is so that when i push it, a template is pushed instead, like:
token: #INSERT YOUR TOKEN HERE
another_secret_variable: #INSERT YOUR SECRET VARIABLE HERE
I don't think there's a way to do it. If you want the file to be pushed to your remote repository, then it has to be tracked by git, and if git is tracking it, it will save any changes you make to it.
You can manually remove it from every commit (or manually stage every file except that one), but that would be a real pain.
The best way to go about doing what you are trying to do is probably to have a second file called secret.yml.template or something like that where you will have the template, and then in your README (or wherever you instruct users to add their tokens to secret.yml) instruct them to change the name of the file tosecret.yml`.
Then you just add secret.yml to your .gitignore and everything should be good.
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