# builtin.git fails to clone private repo

**URL:** <https://forum.ansible.com/t/builtin-git-fails-to-clone-private-repo/37284>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [October 31, 2022, 10:22pm UTC](https://forum.ansible.com/t/builtin-git-fails-to-clone-private-repo/37284 "2022-10-31T22:22:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Don\_Bower](https://avatars.discourse-cdn.com/v4/letter/d/4da419/32.png) [@Don\_Bower](https://forum.ansible.com/u/Don_Bower)\
**Post date:** [October 31, 2022, 10:22pm UTC](https://forum.ansible.com/t/builtin-git-fails-to-clone-private-repo/37284/1 "2022-10-31T22:22:59Z")

</div>

Here is my task:

- name: Install Private Git Repos  
git:  
repo: “{{ item.repo }}”  
dest: “/home/don/Developer/{{ item.dest }}”  
with\_items:
- repo: [git@github.com](mailto:git@github.com):DonBower/ansible.git  
dest: ansible

I can do this manually from the target hosts command line, but running ansible-playbook results in:

failed: [[ideapad-ubuntu.ag6hq.net](http://ideapad-ubuntu.ag6hq.net)] (item={‘repo’: ‘git@github.com:DonBower/ansible.git’, ‘dest’: ‘ansible’}) =\> {  
“ansible\_loop\_var”: “item”,  
“changed”: false,  
“cmd”: [  
“/usr/bin/git”,  
“fetch”,  
“–tags”,  
“origin”  
],  
“invocation”: {  
“module\_args”: {  
“accept\_hostkey”: false,  
“accept\_newhostkey”: false,  
“archive”: null,  
“archive\_prefix”: null,  
“bare”: false,  
“clone”: true,  
“depth”: null,  
“dest”: “/home/don/Developer/ansible”,  
“executable”: null,  
“force”: false,  
“gpg\_whitelist”: ,  
“key\_file”: null,  
“recursive”: true,  
“reference”: null,  
“refspec”: null,  
“remote”: “origin”,  
“repo”: “[git@github.com](mailto:git@github.com):DonBower/ansible.git”,  
“separate\_git\_dir”: null,  
“single\_branch”: false,  
“ssh\_opts”: null,  
“track\_submodules”: false,  
“umask”: null,  
“update”: true,  
“verify\_commit”: false,  
“version”: “HEAD”  
}  
},  
“item”: {  
“dest”: “ansible”,  
“repo”: “[git@github.com](mailto:git@github.com):DonBower/ansible.git”  
},  
“msg”: “Failed to download remote objects and refs: Host key verification failed.\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n”  
}

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [November 1, 2022, 3:09am UTC](https://forum.ansible.com/t/builtin-git-fails-to-clone-private-repo/37284/2 "2022-11-01T03:09:22Z")

</div>

You have both

“accept\_hostkey”: false,  
“accept\_newhostkey”: false

Does it run as you, or do you “–become”? Because there appears to be no key for [github.com](http://github.com) in that user’s ~/.ssh/known\_hosts file.
