# How to use git on ansible ?

**URL:** <https://forum.ansible.com/t/how-to-use-git-on-ansible/21956>\
**Category:** Ansible Project\
**Created:** [July 8, 2016, 8:38am UTC](https://forum.ansible.com/t/how-to-use-git-on-ansible/21956 "2016-07-08T08:38:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javier\_Barroso](https://avatars.discourse-cdn.com/v4/letter/j/9de053/32.png) [@Javier\_Barroso](https://forum.ansible.com/u/Javier_Barroso)\
**Post date:** [July 8, 2016, 8:38am UTC](https://forum.ansible.com/t/how-to-use-git-on-ansible/21956/1 "2016-07-08T08:38:39Z")

</div>

Hello,

I have reviewed ansible git module [1], but I don’t find how it could work with my workflow.

My workflow is the next:

- dir\_fschanges: /srv/ansible/fschanges
- project: myproject
- Create a local {{dir\_fschanges}}/{{project}} git empty repository
- Use fetch module to fetch files to {{dir\_fschanges}}/{{project}}
- cd {{dir\_fschanges}}/{{project}}
- git add \*
- git commit “Files from servers” \*  
\<= Here start a loop of modifications …
- git branch mymods
- git checkout mymods
- Modify {{dir\_fschanges}}/{{project}} files, trying to use ansible modules
- git add \*
- git commit -m “Files modified with ansible”  
\<= Endloop
- Review changes and Copy files from repo to servers and possibly restart services affected

If I need to copy files from servers, I would git checkout master

How can I integrate git commands on ansible playbooks without using command / shell modules. Using command will tell about using git module

Thank you very much

[1] [http://docs.ansible.com/ansible/git\_module.html](http://docs.ansible.com/ansible/git_module.html)
