在 vagrant shell 脚本中暂停输入

Pausing for input in vagrant shell script

我正在使用 VVV vagrant box (https://github.com/Varying-Vagrant-Vagrants/VVV)

我正在尝试构建我自己的 shell 下载存储库的脚本。

我正在这样做:

echo "cloning staging server repo"

git clone https://User@github.com/rep/therepo.git

如果我 运行 这个 shell 脚本本身,那么命令提示符会要求我输入密码。这是我希望它工作的方式。

当我 运行 vagrant provision 它立即失败,因为没有提供密码。我不想将密码保存为 URL.

的一部分

有没有办法让它在提供期间按照我的预期通过 https 工作,或者是我通过 SSH 克隆它使其工作的唯一方法吗?

我还没有找到与 Vagrant 交互提示的方法。看来您可以 (a) 在 config.vm.provision 中使用 args 传递值,或者 (b) 使用密码加载文件。

有很多很好的语法示例 here,例如:

Vagrant.configure("2") do |config|
  config.vm.provision "shell",
    inline: "/bin/sh /path/to/the/script/already/on/the/guest.sh"
end

您可以从您的供应商调用脚本,如上所示,或者编写更多 ruby 来执行此操作。