ssh -vT [git@gitlab.com](mailto:git@gitlab.com)
[...]
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
**Welcome to GitLab**, @mukuntharajaa!
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [eow@openssh.com](mailto:eow@openssh.com) reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2776, received 3416 bytes, in 0.9 seconds
Bytes per second: sent 2926.2, received 3600.8
debug1: Exit status 0
Only via Ansible, git cloning is failing.
fatal: [192.168.99.105]: FAILED! => {"changed": false, "cmd": ["/usr/bin/git", "fetch", "--tags", "origin"], "msg": "Failed to download remote objects and refs: Load key \"/home/mrajaa/.ssh/id_rsa.pub\": **invalid format\r\[ngit@gitlab.com](mailto:ngit@gitlab.com): Permission denied (publickey)**.\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n"}
>ssh -vT git@gitlab.com <mailto:git@gitlab.com> [...] debug1: Sending environment. debug1: Sending env LANG =
en_US.UTF-8 *Welcome to GitLab*, @mukuntharajaa! debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com <mailto:eow@openssh.com> reply 0 debug1: channel 0:
free: client-session, nchannels 1 Transferred: sent 2776, received 3416 bytes, in 0.9 seconds Bytes per second: sent
2926.2, received 3600.8 debug1: Exit status 0 |
Only via Ansible, git cloning is failing.
>fatal: [192.168.99.105]: FAILED! => {"changed": false, "cmd": ["/usr/bin/git", "fetch", "--tags", "origin"], "msg":
"Failed to download remote objects and refs: ||Load key \"/home/mrajaa/.ssh/id_rsa.pub\": *invalid format\r\ngit@gitlab.com <mailto:ngit@gitlab.com>: Permission
denied (publickey)*.\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access
rights\nand the repository exists.\n"} |
My git clone task is like this,
------------------------------------------------------------------------------------------------------------------------
name: use git to clone myconfigs
git:
dest: “{{ myconfig_dir }}”
repo: “{{ dotfile_repo }}”
accept_hostkey: yes
key_file: “{{ ssh_key }}”
force: no #this will not forcefully clone, if there are some local modifications
ignore_errors: true
```
The value for key_file expects the path to the *private* SSH key.
ssh -vT [git@gitlab.com](mailto:git@gitlab.com)
[...]
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
**Welcome to GitLab**, @mukuntharajaa!
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [eow@openssh.com](mailto:eow@openssh.com) reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2776, received 3416 bytes, in 0.9 seconds
Bytes per second: sent 2926.2, received 3600.8
debug1: Exit status 0
Only via Ansible, git cloning is failing.
fatal: [192.168.99.105]: FAILED! => {"changed": false, "cmd": ["/usr/bin/git", "fetch", "--tags", "origin"], "msg": "Failed to download remote objects and refs: Load key \"/home/mrajaa/.ssh/id_rsa.pub\": **invalid format\r\[ngit@gitlab.com](mailto:ngit@gitlab.com): Permission denied (publickey)**.\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n"}
My git clone task is like this,
name: use git to clone myconfigs
git:
dest: “{{ myconfig_dir }}”
repo: “{{ dotfile_repo }}”
accept_hostkey: yes
key_file: “{{ ssh_key }}”
force: no #this will not forcefully clone, if there are some local modifications
ignore_errors: true