Wagrant git clone error resolution error

I am using a stroller with an accessible position. When I make a git clone with impossible I get the following error:

failed: [default] => {"cmd": "/usr/bin/git ls-remote '' -h refs/heads/HEAD", "failed": true, "rc": 128}
stderr: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

msg: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

FATAL: all hosts have already failed -- aborting

      

But when I try to clone from vagrant box it works great. I have searched the net and I have ssh forwarding set to true in vagrant and my ~ / .ssh / config looks like this, which allows forwarding from the host machine.

Host            *
  ForwardAgent  yes

      

My familiar yml file looks like this:

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

      

My vagrant file looks like this:

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

      

Another question, when I do git clone from ansible, why is it executing the following command instead of git clone:

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

      

+3


source to share


1 answer


My bet is that Ansible does not do SSH key forwarding (ForwardAgent yes) with your configuration.

A possible workaround is to create custom deployment keys, use Ansible to configure them in the target deployment environment, and then use those keys to create a clone.



eg. fooobar.com/questions/383505 / ...

+1


source







All Articles