# git version not cloning branch

**URL:** <https://forum.ansible.com/t/git-version-not-cloning-branch/28238>\
**Category:** Ansible Project\
**Created:** [August 2, 2018, 3:37pm UTC](https://forum.ansible.com/t/git-version-not-cloning-branch/28238 "2018-08-02T15:37:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtim.arnold](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@jtim.arnold](https://forum.ansible.com/u/jtim.arnold)\
**Post date:** [August 2, 2018, 3:37pm UTC](https://forum.ansible.com/t/git-version-not-cloning-branch/28238/1 "2018-08-02T15:37:48Z")

</div>

hi,  
I’m using the git module, specifying ‘centos’ as the version. ‘centos’ is the name of a branch in my gitlab repo.  
No errors, and the clone part works but always ‘master’ is what’s left in the destination. I suppose the code actually does a clone and then a checkout of the branch.  
So it looks like the checkout is not happening.

ansible 2.6.2, python 2.7.5

I get this response:  
changed: [mymachine] =\> (item={u’version’: u’centos’, u’reponame’: u’myrepo’, u’destname’: u’/path/to/code/repodir’})

What am I doing wrong? This is the relevant snip from my playbook.

- name: retrieve repos  
become\_user: myusername  
git:  
repo: [git@gitlab.myco.com](mailto:git@gitlab.myco.com):myusername/{{ item.reponame }}.git  
accept\_hostkey: yes  
ssh\_opts: “-o StrictHostKeyChecking=no”  
clone: yes  
force: yes  
dest: “{{ item.destname }}”

loop:

- {‘reponame’: ‘myrepo’, ‘destname’: “{{coderoot}}/myrepo”, ‘version’: ‘centos’}  
more repos go here…

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lozada\_De\_L](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jonathan\_Lozada\_De\_L](https://forum.ansible.com/u/Jonathan_Lozada_De_L)\
**Post date:** [August 17, 2018, 4:36am UTC](https://forum.ansible.com/t/git-version-not-cloning-branch/28238/2 "2018-08-17T04:36:35Z")

</div>

you need to add version: centos
