# git module, accept\_hostkey=yes doesn't work

**URL:** <https://forum.ansible.com/t/git-module-accept-hostkey-yes-doesnt-work/15119>\
**Category:** Ansible Project\
**Created:** [April 30, 2014, 1:27pm UTC](https://forum.ansible.com/t/git-module-accept-hostkey-yes-doesnt-work/15119 "2014-04-30T13:27:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Damjan\_Georgievski](https://avatars.discourse-cdn.com/v4/letter/d/e19b73/32.png) [@Damjan\_Georgievski](https://forum.ansible.com/u/Damjan_Georgievski)\
**Post date:** [April 30, 2014, 1:27pm UTC](https://forum.ansible.com/t/git-module-accept-hostkey-yes-doesnt-work/15119/1 "2014-04-30T13:27:59Z")

</div>

```auto
I'm running the task:

- name: Cloning homepage repo...
  sudo_user: gitpull
  git: repo=ssh://git@git.server.com:222/websites/homepage.com.git dest=/var/www/{{ branch}}/ version={{ branch }} accept_hostkey=yes
  changed_when: False

but the task gets stuck always. I've tried ansible 1.5.5, 1.5.0, 1.5.3 and the latest git (on ArchLinux).

This is the process tree when it's stuck:

25857 pts/1 S+ 0:00 \_ /usr/bin/python /tmp/ansible-tmp-1398860300.45-147818427778432/git
25859 pts/1 S+ 0:00 \_ /usr/bin/git ls-remote ssh://git@git.server.com:222/websites/homepage.git -h refs/heads/master
25860 pts/1 S+ 0:00 \_ ssh -p 222 git@git.server.com git-upload-pack '/websites/homepage.git'

If I strace that ssh process I see it tries to read from fd 4, which acording to /proc/25860/fd/4 is /dev/tty

/home/gitpull/.ssh/known_hosts is created but is empty.

I've tried manually cloning the repo and it asks me to confirm the host key, I say 'yes' it's added to known_hosts and the clone finishes soon after.
Then I'd remove /home/gitpull/.ssh/known_hosts and the task gets stuck again.

The target OS is Debian 7.5

```

---

<div class="post-metadata">

**Author:** ![Damjan\_Georgievski](https://avatars.discourse-cdn.com/v4/letter/d/e19b73/32.png) [@Damjan\_Georgievski](https://forum.ansible.com/u/Damjan_Georgievski)\
**Post date:** [April 30, 2014, 2:03pm UTC](https://forum.ansible.com/t/git-module-accept-hostkey-yes-doesnt-work/15119/2 "2014-04-30T14:03:35Z")

</div>

> ```auto
> /home/gitpull/.ssh/known_hosts is created but is empty.
> 
> ```

digging through the code it seems to me that the function add\_host\_key in module\_utils/known\_hosts.py doesn’t support using a different port than the standard one??

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [April 30, 2014, 8:18pm UTC](https://forum.ansible.com/t/git-module-accept-hostkey-yes-doesnt-work/15119/3 "2014-04-30T20:18:27Z")

</div>

This is quite possible given the accept\_hostkey magic is new (you could also manage known\_hosts yourself manually to get around this).

If you think this is a bug, please make sure it’s filed on [github.com/ansible/ansible](http://github.com/ansible/ansible).

(Patches also welcome!)

This way we won’t lose track of it.

Thanks!

---

<div class="post-metadata">

**Author:** ![J\_Dav](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@J\_Dav](https://forum.ansible.com/u/J_Dav)\
**Post date:** [September 16, 2014, 3:42pm UTC](https://forum.ansible.com/t/git-module-accept-hostkey-yes-doesnt-work/15119/4 "2014-09-16T15:42:59Z")

</div>

Also facing the same issue

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 16, 2014, 5:10pm UTC](https://forum.ansible.com/t/git-module-accept-hostkey-yes-doesnt-work/15119/5 "2014-09-16T17:10:02Z")

</div>

Thanks, was a ticket filed on this one?

If you can’t find a similar one, please do file a ticket.

Thanks!
