0

Since I have multiple git accounts (work_account and personal_account) I am trying to change to my personal account by running:

git config --global user.name 'personal_account'
git config --global user.email 'personal_account@gmail.com'

And:

ssh-add ~/.ssh/personal_account_key

But after all of that, the command ssh -T git@github.com keeps displaying that I am authenticated with my work account:

# ssh -T git@github.com
Hi work_account! You've successfully authenticated, but GitHub does not provide shell access.

How can I change it?

  • 2
    Check this out: https://gist.github.com/oanhnn/80a89405ab9023894df7 – rehnoj Apr 02 '22 at 16:37
  • 2
    `git config` has nothing to do with authentication with GitHub; those are just the name and address used to create a commit locally. You may still have your work key in your SSH agent listed ahead of your personal key, which means `ssh` will use that first, and when it succeeds, it won't try using your personal key. What you want to do is define different *aliases* for `github.com` that are associated with different SSH keys and use that as the address for work vs personal repositories. – chepner Apr 02 '22 at 16:47

0 Answers0