Skip to content

Instantly share code, notes, and snippets.

@jjeaton
Created July 5, 2017 12:59
Show Gist options
  • Save jjeaton/27863f56e3fbf02e8251090d50446859 to your computer and use it in GitHub Desktop.
Save jjeaton/27863f56e3fbf02e8251090d50446859 to your computer and use it in GitHub Desktop.
Customfile to share specific host key auth with Vagrant VM.
# -*- mode: ruby -*-
# vi: set ft=ruby ts=2 sw=2 et:
# Add github to known hosts for private repo provisioners
config.vm.provision "shell", run: "always" do |s|
s.inline = <<-SHELL
mkdir -p ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/known_hosts
if ! grep -Fxq "github.com" ~/.ssh/known_hosts; then
ssh-keyscan -t dsa,rsa github.com >> ~/.ssh/known_hosts 2>/dev/null
echo "Success: Added host to SSH known_hosts for user 'root': github.com"
fi
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment