Have a local appsettings.json you don’t want to commit, but it’s already tracked? Don’t use .gitignore; use assume-unchanged.
git update-index --assume-unchanged config.json
Now Git will pretend there are no changes to that file, even if you edit it locally. Perfect for local dev secrets.
