John Crawford John Crawford - 4 months ago 41
Git Question

GitHub Error: Key already in use

I have created two GitHub accounts. One for my work user and one for my personal self. I needed to do catch up on some work and as such cloned my work repo onto my personal PC. In order to do simple "git push origin master" commits without entering my username and password the whole time I simply want to add my public key from my home pc to the work repo. However Github gives this error:

Error: Key already use

After a bit of Googling I came across this link which states "To resolve the issue, remove the key from the other account or repository and add it to your account" Of course there is a duplicate key as I've added my home public key to github so that I can code on my own personal projects. After all I want to be able to code to my work repo using both my work pc and personal pc.

How can you add multiple "same" public keys without Github throwing that error and also why in the world, is that error thrown in the first place?


The key could be already in use on other github projects as deploy key, that's a bit tricky to find but run:

ssh -T -ai ~/.ssh/id_rsa

to find the used key, delete it and then readd it again in the right user/repo. that was very useful for me