Skip to content

Instantly share code, notes, and snippets.

@ar45
Created April 9, 2019 18:21
Show Gist options
  • Save ar45/ea877591b2d914d9239c446f41e2dd7d to your computer and use it in GitHub Desktop.
Save ar45/ea877591b2d914d9239c446f41e2dd7d to your computer and use it in GitHub Desktop.
Add github public key to known hosts
#!/bin/bash
ssh-keygen -R github.com
ssh-keyscan -t rsa github.com >/tmp/github.pub && \
[ "`ssh-keygen -l -f /tmp/github.pub`" = "2048 SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8 github.com (RSA)" ] && \
echo yes && \
cat /tmp/github.pub >> ~/.ssh/known_hosts \
|| echo no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment