đ GIT SSH Config
Introduction
A quick post on how to manage private SSH keys across work and personal GIT repositories on your machine.
Please see original superuser.com post used to shape this article for more context.
Managing SSH Keys
If you don't want to mess around with your root SSH configuration at ~/.ssh/config to manage a personal Github account and a work account, you can use the GIT_SSH_COMMAND environment variable to tell GIT which private SSH key to use on your machine.
By setting this environment variable, commands to connect to the remote like git fetch, git clone and git push will use the specified command instead of the default SSH command. This allows us to tell SSH which private key to use when running a command like git clone.
Each host alias in your SSH config maps to a different private key, routing git commands to the right GitHub account.
To clone an existing repository from the remote onto your machine:
1GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_super_cool_key -F /dev/null" git clone super-cool-repo
The file parameter provides SSH with an empty configuration file -F /dev/null (UNIX-like operating systems only).
Once you've got your personal repository cloned, you can set the local GIT configuration for future commands like git push and git pull that connect to the remote.
1git config core.sshCommand "ssh -i ~/.ssh/id_rsa_super_cool_key -F /dev/null"
Sometimes my personal SSH keys get removed from the ssh-agent. I'm not entirely sure why đ, but if you're unable to connect to the remote with git commands, it's worth checking your SSH key is still added to your ssh-agent for your local git configuration to use.
Use the -l flag to list SSH keys in ssh-agent by fingerprint.
1ssh-add -l
Add a private key to ssh-agent.
1ssh-add ~/.ssh/id_rsa_super_cool_key
Was this useful?
Thanks for reading! Time for one more?
<Emoji emoji="â" label="high five" />// <span role="img" aria-label="high five">â</span><img src={src} /> // missing alt prop
â Accessible Emojis
06 Oct 2021 âĸ đ 5 min read âĸ Updated 15 Mar 2026Using eslint-plugin-jsx-a11y to catch accessibility issues during development.
@mixin responsive($type) {@if $type == mobileMinMax {@media (max-width: 800px) { @content; }}}
đą Responsive Mixin
23 Sept 2021 âĸ đ 4 min read âĸ Updated 15 Mar 2026A responsive sass mixin to clean-up your messy media queries.