I'm using ansible (Trellis) to deploy my projects.
I have a repo on github.
This is my ansible code
- name: UPDATE - Clone project files
become: yes
# become_user: "{{ project.user.name | default(ansible_web_user) }}"
git:
repo: "{{ project.git.ssh }}"
dest: "{{ project_root }}/shared/source"
version: "{{ project.git.branch | default('master') }}"
accept_hostkey: "{{ project.git.accept_hostkey | default(repo_accept_hostkey | default(true)) }}"
force: yes
# key_file: "/root/.ssh/id_rsa.pub"
ignore_errors: false
no_log: false
register: git_clone
For some days this error has appeared for no apparent reason, nothing has changed
FAILED! => {"changed": false, "cmd": "/usr/bin/git ls-remote origin -h refs/heads/master", "msg": "fatal: 'origin' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.", "rc": 128, "stderr": "fatal: 'origin' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n", "stderr_lines": ["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."], "stdout": "", "stdout_lines": []}
I've tried several solutions, even removing the forwardAgent and forcing the key_file directly into the git call. It still returns an error.
But if I connect via ssh to the target machine and try to do a git clone .... everything works.
I don't understand what the problem could be.