Just keep a .gitconfig in your HOME with aliases for your identities. Then just after initializing/cloning the repo do git config-company or git config-personal
How would you do the initial clone without the correct ssh config to begin with? I think the benefit of the article's method is that any clone from their org will just work.
I have something like the parent suggests and yes, the article's idea is better because you don't need to do anything manual nor remember to run your own command at all.
You are right - that first clone has to be manually preceded by GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_personal" - but after this you just configure the repo and forget about it.
I just like this workflow better since it is totally directory/remote agnostic (compared to the article).
The same exact config you'd have to replicate for the OP's solution is what you'd have to replicate as well. It also means your config is semi-copied into every repo instead of being centrally managed. This is like the worst of all options, idgi.
I'm sorry, I don't want to be mean but this has got to be the worst way Ive seen someone try to solve this. I want to cry skimming it. Why would anyone do this and think it's simpler? Wew, gotta just leave this one alone.
You don't need to specify your key file like that if you've got your keys loaded into an SSH agent. Or even better, IMO: use 1Password or similar that can both store your keys securely _and_ can be used directly as an SSH agent. That way, your SSH keys never need to be stored on disk in the first place.
When I was a child I had a mild case of synesthesia. I would often see colors or feel textures when hearing sounds. Touching different textures would trigger memories associated with the sound-texture pair... A wild trip for an adult, but at that time I thought everybody perceived the world that way.
I have also had a feeling for Magic. An unmistakable tingling, in my brain, when I learned/discovered something new. It was the best feeling in the world - it kept me exploring and learning the unknown.
All of that started getting weaker somewhere in my teens. Then it completely disappeared when I was around 20. I still hold the memories, the codex of sound/color/textures, but nothing triggers it. Nothing triggers the Magic sense. It all just faded away.
Just keep a .gitconfig in your HOME with aliases for your identities. Then just after initializing/cloning the repo do git config-company or git config-personal