SSH Keys and Host Verification for GitHub
Two separate key roles
Your SSH key pair authenticates you to a server: the public key can be registered with the authorized account, while the private key remains under your control and should be protected with a passphrase and appropriate permissions. The server has a different host key. The client checks the host key to avoid connecting to an impostor. A user public key is not a host fingerprint. An SSH agent can help use keys without repeatedly typing their passphrase; protect access to the agent.
Authorized setup checklist
Only on a device and account you control: check for existing keys before generating a new one; use the official GitHub guide for a supported algorithm such as Ed25519 when appropriate. Choose a fresh filename to avoid overwriting an existing key, set a strong passphrase, and register only the .pub file with the approved account. Use an approved SSH agent if needed. An SSH remote commonly has the form git@github.com:OWNER/REPOSITORY.git; the SSH username is git, not your personal account name. This lesson does not generate or register keys.
Stop at an unexpected fingerprint
On a first connection, compare the displayed host fingerprint and algorithm with the official fingerprint page obtained through a trusted channel. Accept only a match. A changed known host key deserves investigation; stop and check announcements or contact the administrator. Do not blindly remove known_hosts entries or disable strict host checking. After authorized setup, ssh -T git@github.com is a documented authentication test; GitHub does not offer interactive shell access, and successful authentication normally exits with status 1. It contacts GitHub and may prompt about host trust, so do not run it in this offline lab.
Practice example
OFFLINE SCENARIO — not an SSH transcriptPresented host fingerprint: fingerprint-BTrusted reference: fingerprint-ADecision: STOP and investigateThe labels are fictional, not usable fingerprints. Do not accept a mismatch.
Check your understanding
Classify a user public key, private key and host key; identify when a host-key warning requires stopping.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
SSH Keys and Host Verification for GitHub — knowledge check
Choose safe authentication and identity practices in fictional scenarios.
Which key may be registered in the GitHub account?
What does the SSH host key identify?
The presented fingerprint differs from the trusted reference. What now?
What does an SSH agent assist with?
Why choose a fresh key filename?