Created
July 5, 2017 12:59
-
-
Save jjeaton/27863f56e3fbf02e8251090d50446859 to your computer and use it in GitHub Desktop.
Customfile to share specific host key auth with Vagrant VM.
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
# -*- 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