ssh - Vagrant ansible git clone permission error -


i using vagrant ansible provision. when doing git clone ansible getting following error:

failed: [default] => {"cmd": "/usr/bin/git ls-remote '' -h refs/heads/head", "failed": true, "rc": 128} stderr: permission denied (publickey). fatal: not read remote repository.  please make sure have correct access rights , repository exists.  msg: permission denied (publickey). fatal: not read remote repository.  please make sure have correct access rights , repository exists.  fatal: hosts have failed -- aborting 

but when ever trying clone vagrant box manually works fine. have searched net , have got ssh forwarding set true in vagrant , ~/.ssh/config looks following allows forwarding host machine.

host            *   forwardagent  yes 

my ansible yml file follows:

--- - hosts:   sudo: true   tasks:     - name: clone project       git: repo=<git ssh link>            accept_hostkey=yes            clone=yes            dest=/home/vagrant 

my vagrant file follows:

vagrant.configure(2) |config|   config.vm.box = "ubuntu/trusty64"   config.vm.network "forwarded_port", guest: 80, host: 9000   config.vm.provision :ansible |ansible|     ansible.playbook = "playbook.yml"   end   config.ssh.forward_agent = true end 

one more question whenever doing git clone ansible why runs following command instead of git clone:

/usr/bin/git ls-remote '' -h refs/heads/head 

my bet on ansible doesn't ssh key forwarding (forwardagent yes) config.

possible suggested workaround create deployment specific keys, use ansible set them in deployment target , use these keys clone.

e.g. https://stackoverflow.com/a/29727859/315168


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -