Hi all I am trying to pull a repo from my github to a vagrant box via ansible, refering this github issue. I have registered an ssh from my host with the github. And below is the part in the playbook where I'm trying to pull;
- name: install git
apt: name=git
- name: create the ssh public key file
copy: src=/home/user/.ssh/id_rsa.pub dest=/root/.ssh/id_rsa.pub mode=0644
- name: create the ssh private key file
copy: src=/home/user/.ssh/id_rsa dest=/root/.ssh/id_rsa mode=0600
- name: setup git repo
git: repo=git@github.com:myusername/project_foo_bar.git dest=/home/projects/myproject accept_hostkey=yes key_file="/root/.ssh/id_rsa"
After installing git I've copied my public and private keys to the box but my provisioning fails in the last step. I'm unable to pull the repo, instead get the below error;
TASK: [setup git repo] ********************************************************
failed: [default] => {"cmd": "/usr/bin/git ls-remote origin -h refs/heads/master", "failed": true, "rc": 128}
stderr: fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
msg: fatal: 'origin' does not appear to be a git repository
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
Am I wrongly entering the address. I tried repo=ssh://git@github.com/myusername/project_foo_bar.git
but that too doesn't fly
You init a repository in
/home/projects/myproject
directory and then try to clone a github repo to the very same directory.Remove init task, delete
/home/projects/myproject
directory from the box and run your playbook again.