Looking at the docu for chef you can add the ssh_wrapper
parameter for this https://docs.chef.io/resource_git.html which will allow you to clone with a certain user.
Possible ssh_wrapper
your ssh_wrapper
could look like:
ssh_wrapper "ssh -i /some/path/id_rsa"
All Parameters
git 'name' do
additional_remotes Hash
checkout_branch String
depth Integer
destination String # defaults to 'name' if not specified
enable_checkout TrueClass, FalseClass
enable_submodules TrueClass, FalseClass
environment Hash
group String, Integer
notifies # see description
provider Chef::Provider::Scm::Git
reference String
remote String
repository String
revision String
ssh_wrapper String
subscribes # see description
timeout Integer
user String, Integer
action Symbol # defaults to :sync if not specified
end