Question

I'm trying to ssh into github using a different private key than my original one. It seems like the ssh request is somehow cached, because no matter what I do when I call ssh -T git@github.com, it says

Hi [wrong-user] You've successfully authenticated...

I've tried doing a variety of things:

  • Removing github.user and user.email from my .gitconfig
  • Removing my id_rsa completely
  • Using ssh -i with different identity files including an invalid identity file
  • Updating my .ssh/config with

Host github.com
    HostName github.com
    User git
    IdentityFile /path/to/private/key/for/right-user

No matter what it seems like I always get a response from github logging in as the wrong user.

Is there something else I can do to tell github to use a different user / private key to authenticate?

Was it helpful?

Solution

You can check your cached ssh keys with ssh-add -l.

You can delete all cached keys with ssh-add -D.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top