# Task Git Clone Returns Fail when repository cloned

**URL:** <https://forum.ansible.com/t/task-git-clone-returns-fail-when-repository-cloned/27102>\
**Category:** Ansible Project\
**Created:** [March 24, 2018, 2:00am UTC](https://forum.ansible.com/t/task-git-clone-returns-fail-when-repository-cloned/27102 "2018-03-24T02:00:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Kilmer](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mike\_Kilmer](https://forum.ansible.com/u/Mike_Kilmer)\
**Post date:** [March 24, 2018, 2:00am UTC](https://forum.ansible.com/t/task-git-clone-returns-fail-when-repository-cloned/27102/1 "2018-03-24T02:00:32Z")

</div>

I use an Ansible provisioning and deployment framework called [Trellis](https://discourse.roots.io/t/deployment-bitbucket-ssh-forwarding-problem/6652/9?u=mzoo) to deploy Wordpress-based applications.

I’m cloning the master from a private Bitbucket repository using the following tasks:

`

- name: Clone project files  
git:  
repo: “{{ project\_git\_repo }}”  
dest: “{{ project\_source\_path }}”  
version: “{{ project\_version }}”  
accept\_hostkey: “{{ project.repo\_accept\_hostkey | default(repo\_accept\_hostkey | default(true)) }}”  
ignore\_errors: true  
no\_log: true  
register: git\_clone

- name: Failed connection to remote repo  
fail:  
msg: |  
Error message here (removed for brevity)  
when: git\_clone | failed  
`

The task fails, delivering the error message, but it does clone the repository. I had added some [debugging code](https://discourse.roots.io/t/deployment-bitbucket-ssh-forwarding-problem/6652/9?u=mzoo), confirming that I was in fact accessing the correct repository successfully (before noticing that the codebase was being cloned.)

I’m not sure why the task is (or thinks it is) failing or where to look for answers.

Loving Python and Ansible.

Hoping someone can help.

---

<div class="post-metadata">

**Author:** ![Mike\_Kilmer](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mike\_Kilmer](https://forum.ansible.com/u/Mike_Kilmer)\
**Post date:** [March 24, 2018, 2:20am UTC](https://forum.ansible.com/t/task-git-clone-returns-fail-when-repository-cloned/27102/2 "2018-03-24T02:20:42Z")

</div>

Forgot to mention: ansible 2.4.3.0

`  
[defaults]  
callback\_plugins = ~/.ansible/plugins/callback\_plugins/:/usr/share/ansible\_plugins/callback\_plugins:lib/trellis/plugins/callback  
stdout\_callback = output  
filter\_plugins = ~/.ansible/plugins/filter\_plugins/:/usr/share/ansible\_plugins/filter\_plugins:lib/trellis/plugins/filter  
force\_color = True  
force\_handlers = True  
inventory = hosts  
nocows = 1  
roles\_path = vendor/roles  
vars\_plugins = ~/.ansible/plugins/vars\_plugins/:/usr/share/ansible\_plugins/vars\_plugins:lib/trellis/plugins/vars  
vault\_password\_file = .vault\_pass

[ssh\_connection]  
ssh\_args = -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s  
pipelining = True  
retries = 1  
`

---

<div class="post-metadata">

**Author:** ![Mike\_Kilmer](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Mike\_Kilmer](https://forum.ansible.com/u/Mike_Kilmer)\
**Post date:** [March 24, 2018, 5:42pm UTC](https://forum.ansible.com/t/task-git-clone-returns-fail-when-repository-cloned/27102/3 "2018-03-24T17:42:04Z")

</div>

The issue in this case was caused by a git submodule to which I hadn’t committed and push my latest code changes. I committed and pushed to the submodule repo and the problem went away. I discovered this by logging into the server and running `git status` within the repository codebase.
