A common scenario when I develop is that the codebase will have several config files which require machine specific settings. These files will be checked into Git and other
Check in a default configuration with a different extension (say .default), use a symlink to symlink the default to the correct location, add the correct location to .gitignore, and add everything else related to the configuration to .gitignore (so the only thing that gets checked in is config.default).
Additionally, write a quick install script that sets up the symlinks for your application-wide.
We used a similar approach at a previous company. The install script autodetected what environment you were running in (sandbox, development, QA, production), and would automatically do the right thing. If you had a config.sandbox file, and were running from the sandbox, it would link that (otherwise it would just link the .defaults file). Common procedure was to copy .defaults and change settings as necessary.
Writing the install script is easier than you might imagine, and gives you a lot of flexibility.