SSH keys and GitHub
Keys, agents and the errors that come with them. 12 commands.
- Generate an SSH key and add it to GitHubGenerate an SSH key, add it to your GitHub account and test it, so you can push and pull without typing a password.
- Fix "Permission denied (publickey)"What to check when git push or ssh to GitHub says Permission denied (publickey).
- Test your SSH connection to GitHubCheck your SSH key works with GitHub, and what each answer means.
- Change or remove your SSH key's passphraseSet a new passphrase on your key, or remove it, without making a new key.
- Fix "Host key verification failed"SSH doesn't know the server yet and can't ask you, often in scripts or CI. Add the server's key to known_hosts.
- Fix "REMOTE HOST IDENTIFICATION HAS CHANGED"SSH refuses to connect because a server's key changed, often after it was rebuilt. Remove the old key and reconnect.
- Fix "UNPROTECTED PRIVATE KEY FILE" and "bad permissions"SSH refuses a key that other users could read. Make it private to you.
- Load your SSH key automaticallyStop typing your key's passphrase every time: let the SSH agent remember it.
- Show and copy your public SSH keyPrint your public SSH key and copy it, ready to paste into GitHub or a server.
- Sign your commits with your SSH keyGet the green "Verified" badge on GitHub, using the SSH key you already have.
- Use a specific SSH key for a Git repoMake Git use a particular SSH key, for one command or for one repo, instead of your default key.
- Use two GitHub accounts on one machineKeep a work and a personal GitHub account side by side, each with its own SSH key.