Created
September 3, 2017 10:25
-
-
Save jpswade/63bab340c672fb5c6baf5c1fed953eb5 to your computer and use it in GitHub Desktop.
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
[[ -e ~/.ssh/id_rsa ]] || ssh-keygen -t rsa -f ~/.ssh/id_rsa -N "" | |
ssh_hosts="github.com bitbucket.org" | |
for ssh_host in ${ssh_hosts[@]}; do | |
ssh_host_ips="$(host ${ssh_host} | awk '/has address/ { print $4 }')" | |
ssh-keygen -R ${ssh_host} | |
ssh-keyscan -H ${ssh_host} >> ~/.ssh/known_hosts | |
for ssh_host_ip in ${ssh_host_ips[@]}; do | |
ssh-keygen -R ${ssh_host_ip} | |
ssh-keygen -R ${ssh_host},${ssh_host_ip} | |
ssh-keyscan -H ${ssh_host},${ssh_host_ip} >> ~/.ssh/known_hosts | |
ssh-keyscan -H ${ssh_host_ip} >> ~/.ssh/known_hosts | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment