Skip to content

Instantly share code, notes, and snippets.

@FelikZ
Created August 16, 2018 13:39
Show Gist options
  • Save FelikZ/94e67967b3b22e61d94ee68b184702d4 to your computer and use it in GitHub Desktop.
Save FelikZ/94e67967b3b22e61d94ee68b184702d4 to your computer and use it in GitHub Desktop.
Fix known_hosts file "Jenkins Host key verification failed"
#!/bin/bash
for domain in "github.com" "bitbucket.org"; do
echo $domain
sed -i "/$domain/d" ~/.ssh/known_hosts
line=$(ssh-keyscan $domain,`nslookup $domain | awk '/^Address: / { print $2 ; exit }'`)
echo $line >> ~/.ssh/known_hosts
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment