2017-10-19 239 views
0

当Vagrant完成配置Ubuntu时,我有一个脚本,它安装所有依赖项和来自不同存储库的两个项目。但我的git克隆失败,此消息:从配置脚本git克隆失败

Cloning into 'frontend'... 
Host key verification failed. 
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights 
and the repository exists. 

但是,当我做我的git clone在SSH它完全...我在我的配置文件与克隆之前desactivated的StrictHostKeyChecking

echo -e "Host *" >> /home/vagrant/.ssh/config 
echo -e "\tStrictHostKeyChecking no" >> /home/vagrant/.ssh/config 

为什么git克隆在脚本中失败,而不是在SSH中?我如何解决我的问题?

编辑:为问,我的无业游民文件:

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

Vagrant.configure("2") do |config| 
    config.vm.box = "bento/ubuntu-17.04" 

    config.vm.network "private_network", ip: "192.168.50.5" 
    config.vm.synced_folder "./../projects", "/home/vagrant/projects" 

    config.vm.provider "virtualbox" do |v| 
    v.name = "devOS" 
    end 

    config.vm.provision "shell", path: "./configure" 
end 
+0

还有就是你运行置备脚本根高的机会,您能不能告诉你Vagrantfile? –

+0

当然是! – Wizix

回答

0

所以你的配置脚本以root身份运行,但你有文件更新您的无业游民的用户,当您连这将很好地工作。

你想要的是运行脚本的无业游民用户和您需要的privileged option

privileged(布尔) - 指定是否执行shell脚本 以特权用户或没有(须藤)。默认情况下,这是“真正的”

编辑您的Vagrantfile并更改

config.vm.provision "shell", path: "./configure", privileged: false 
+0

它的工作原理,谢谢! – Wizix