The "yes/no" question the first SSH connection is normally the one to add the remote host fingerprint to your ~/.ssh/known_hosts
.
Warning March 2023:
You can restore it with:
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
(note the >>
, not >
, to *append to your ~/.ssh/known_hosts
file)
Compare the result of that command with the official SSH host keys from GitHub, to make sure you are talking to the "right" github.com.
A safer alternative to add those keys, using jq
:
curl --silent https://api.github.com/meta \
| jq --raw-output '"github.com "+.ssh_keys[]' >> ~/.ssh/known_hosts
After that, if you still have a permission denied, make sure you have added your public key to your GitHub SSH settings.
Test your connection with ssh -Tv github.com
: you should see a welcome message:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.