`ssh -T [email protected]` says "Hi someone-else!" but you need your work account.
IntermediateTroubleshootingAuthentication and Remote Access
Answer
Likely causes → SSH offers the first key in the agent, and GitHub maps that key to the personal account. A key can belong to only one account.
Diagnose → ssh -vT [email protected] 2>&1 | grep -i "offering" shows the order of keys offered.
Fix → Create a host alias with IdentitiesOnly yes and the work key:
Host github-work
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_work
IdentitiesOnly yes
Then use git remote set-url origin git@github-work:ORG/REPO.git.
Prevent → Keep one key per account and always set IdentitiesOnly yes.
More on Authentication and Remote Access
`[email protected]: Permission denied (publickey).` followed by `fatal: Could not read from remote repository.`Beginner`remote: Support for password authentication was removed on August 13, 2021.`Beginner`fatal: Authentication failed for 'https://github.com/org/repo.git/'` with a token that worked last month.Beginner`WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!` when connecting to GitHub over SSH.Intermediate`remote: Repository not found.` for a repo you can open in the browser.Beginner`ssh: connect to host github.com port 22: Connection timed out` on a corporate or hotel network.Intermediate