5 ms·
Just in case anyone is curious, you can get the current github host keys from their HTTP API[1]. Our deploys fetch the latest and add them to a known_hosts file
by aftbit 4y ago
Just in case anyone is curious, you can get the current github host keys from their HTTP API[1]. Our deploys fetch the latest and add them to a known_hosts file as part of the process. We set the `GIT_SSH_COMMAND` environment variable to use a temporary known hosts file with just the needed keys on each deploy. We do it in fabric with Python, but here's similar bash:
curl -s https://api.github.com/meta | jq -r '.ssh_keys | join("\n")' | sed 's/^/github.com /' > /etc/github_known_hosts
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/etc/github_known_hosts" git pull
1: https://api.github.com/meta https://api.github.com/meta