I find GitHub identities to be very confusing and I regularly struggle with them.
Today, my issue is that I've joined another org's GitHub repository as Owner, but I can't pull from my computer. Although, for a different org, it works properly.
git@github.com:DNA-PC/RepoA.git (✅ pull works, uses "DNA-PC" GitHub account)
git@github.com:NEW_ORG/RepoB.git (❗️ pull fails, uses "DNA-PC" GitHub account)
git@github.com:OLD_ORG/RepoC.git (✅ pull works, uses "DNA-PC" GitHub account)
git@github.com:ANOTHER_OLD_ORG/RepoD.git (❗️ pull fails, uses "Vadorequest" GitHub account)
git@github.com:Vadorequest/RepoE.git (✅ pull works, uses "Vadorequest" GitHub account)
I can't figure out why it doesn't work for the new Org, where I have Owner permissions on all repos. Also, I've noticed by re-trying all my account that another old org isn't working anymore either.
To me, things could be simple:
- I have 2 different GitHub accounts (Vadorequest, DNA PC)
- Each has access to different repositories
- Each should be able to pull all repositories they have access to, and SSH keys are proof of identity
So, how is it possible that I can fetch from RepoA
and RepoC
but not from RepoB
? They should all be verified using the same SSH key.
I had to setup "complicated" stuff to make my 2 identities work:
- Add several RSA identities in
~/.ssh
, one for each GitHub Account (Vadorequest, DNA PC) - Add some SSH config with multiple hosts
~/.ssh/config
Host personal-github
HostName github.com
IdentityFile ~/.ssh/id_rsa_personal
Host dna-pc-github
HostName github.com
IdentityFile ~/.ssh/id_rsa_dna-pc-pro
"complicated": I don't understand how it works, and had to follow blindly some tutorials to have something working, and had to change the format of that multiple times, because each variation had its own issues... (e.g: WebStorm not able to use "Open on GitHub", etc.)
I'm looking for an explanation as to why this setup doesn't work, and what should be the best practice for this setup in 2023.