How to route git/SSH between two (or more) GitHub accounts automatically, based on which folder a repo lives in. After setup, every git clone / git push in the right folder uses the right identity — no per-repo configuration.
Tested on macOS, works the same on Linux. On Windows use Git Bash / WSL.
You have multiple GitHub accounts — e.g. personal (youruser) and work (youruser-work) — and one machine. Without this setup, every push uses whichever SSH key was added first to the agent, so half your pushes are rejected with "you don't have permissions to push to X / would you like to create a fork?".