I'm trying to build an environment that when it finishes bringing the VM up it clones a repository into the share directory. The problem is that the box doesn't have SSH permission on the remote repository.
I have a simple bash script:
#!/bin/bash cd /vagrant if [ ! -d "repo" ]; then git clone email@example.com:/my/repo.git end
I get the error:
Host key verification failed.
fatal: The remote end hung up unexpectedly
Which makes sense since there is no keys in
I've done a fair bit of googling to no avail, I've tried to set
config.ssh.forward_agent = true which allows me to manually clone the repo when I'm ssh'ed into the machine but not when it tries to run itself. I've also tried to specify
config.ssh.private_ssh_key = "~/.ssh/id_rsa" but then vagrant simply won't finish loading (I assume the application can't ssh into the box).
So my question is... Do I need to rebuild my base box to include a set of keys and authorize those keys with my remote repo? Or is there an easier solution I'm missing?
note: I've looked at SSH Basics on Vagrant VMs which seem similar but I think this is more about setting up a different user on the box and the solution posted is much more manual than I'd like.