My project uses a secret token that I want git to ignore, while still tracking the file which should contain it.
Most results I have found seem to suggest using a content filter driver, but from what I can tell that needs each user to edit their git config after cloning (ie. (from link) git config --global filter.yourFilterName.smudge 'sed "s/isPhoneGap = .*/isPhoneGap = true/"'
).
I want it to be possible to clone/setup the project without having to do more than git clone
and copy-paste the token into a specified location - no need to run any included scripts, creating any [gitignored/external] files (to paste into), or otherwise configure things. So those filters would not work.
Initially I though it would be as simple as pushing an empty/template file to the repo, and then adding it to .gitignore, but it turns out that you can't ignore tracked files. And using skip-worktree
or assume-unchanged
(which are Answers to some similar questions) seem to have various issues. And need to be run on the client just like the filters anyway.
So I am left wondering: How do I accomplish something as 'simple' as a repo-side setting to ignore changes to a tracked file?
ps: might be worth noting that I am using github?