GitHub Error: Key already in use

后端 未结 7 1961
逝去的感伤
逝去的感伤 2021-01-30 02:54

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

7条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-30 03:51

    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 git@github.com

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

    from: https://help.github.com/articles/error-key-already-in-use/#finding-where-the-key-has-been-used


    edit: as pointed out by @mikhail-morgunov, this doesn't works all the time, you should really use this snippet only if the default id_rsa SSH private key is your github's default one

    this is a snippet where the key name has been extracted:

    ssh -T -ai ~/.ssh/KEY_NAME git@github.com

    change KEY_NAME with the name of your SSH private key and you will be good to go

提交回复
热议问题