Using Unique SSH Keys for Multiple GitHub Accounts

A screenshot from a computer terminal window showing git access denied error with a “denied” stamp graphic overlaid on top.
GitHub doesn’t like multiple accounts. :(
cp ~/.gitconfig ~/.gitconfig-work
cp ~/.gitconfig ~/.gitconfig-personal
code ~/.gitconfig ~/.gitconfig-work ~/.gitconfig-personal
[includeIf "gitdir:~/work/**"]
path = ~/.gitconfig-work
[core]
sshCommand = ssh -i ~/.ssh/id_rsa -F /dev/null
A screenshot of the author’s final .gitconfig file.
A screenshot of the author’s .gitconfig-work file.
My .gitconfig-work file

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Amanda Reilly

Amanda Reilly

Software engineer. Great British Baking Show enthusiast. Obsessed with Beat Saber. Powered by insatiable curiosity and too much Diet Coke.