Created
April 9, 2019 18:21
-
-
Save ar45/ea877591b2d914d9239c446f41e2dd7d to your computer and use it in GitHub Desktop.
Add github public key to known hosts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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