So I have never actually tried, but could you not just have multiple SSH keys in your .ssh folder and run the same command in the article telling git specifically which one to use instead of one within the git directory? That seems like it would fix the issue here without introducing a major security issue. To be blunt... If I was security at a company and found out someone was doing this, I would question why they h…
Host project1.git
Hostname github.com
IdentityFile ~/.ssh/id_project1_ed25519
IdentitiesOnly yes
And then "git checkout git@project1.git:foo/project1.git" to checkout the file.