Search code examples
gitvagrantchef-infrachef-solo

vagrant + chef setup trying to git clone into synced folder


I have a synced folder in my vagrant setup

local.vm.synced_folder "../api", "/api"

and I want to be able to git clone another repository into this folder like this:

git "api" do
  destination "/api"
  repository "git@github.com:<user>/<repo>.git"
  revision "development"
  checkout_branch "development"
  action :sync
end

but I get an error saying:

==> local: STDERR: fatal: could not create work tree dir '/api'.: File exists

tried using another empty but already created folder /test and this worked.


Solution

  • Change the destination to /api/<repo>. Your current code is changing the target of the clone to /api (the equivalent of git clone git@github.com:<user>/<repo>.git /api).