Check Anatomy of a Chef Run
At the moment chef compiles your file resource, git resource is not run (even is not started) yet, so file "/home/#{user_id}/.myconfigs/.zshrc" does not exist.
Possible workarounds:
This will copy the file after it is created by git using FileUtils.
ruby_block "create /home/#{user_id}/.zshrc" do block do ::FileUtils.copy("/home/#{user_id}/.myconfigs/.zshrc", "/home/#{user_id} /.zshrc") unless ::File.exists? "/home/#{user_id}/.zshrc" end end
Symlink instead of copy.
link "/home/#{user_id}/.zshrc" do to "/home/#{user_id}/.myconfigs/.zshrc" end
Run git resource at compile stage.
git "/home/#{user_id}/.myconfigs" do [...] action :nothing end.run_action :checkout