+1 vote
1 view
in Devops and Agile by (28.1k points)

My git workspace is dirty, there are some local modifications. When I use the command

 git pull origin master 

it works fine because there is no conflict.

But when I'm trying to use Ansible like

 git: repo=xxxx dest=xxx version={{branch}} 

I got error

Local modifications exist in repository (force=no)

If I add force=yes, then I will lose my local modifications.

What can I do to keep my local changes and pull the latest commit from git by using the Ansible git module?

1 Answer

0 votes
by (48k points)
edited by

You cannot use this in the git module because ansible will check the results of 

git status --porcelain

And abort this task execution If there are any local changes in tracked files 

The only way is using shell command or tries to keep a clean workspace. Because there is no other module that will execute git pull and git module will not allow this execution.

For more information please go through the following tutorial to get more info about git:

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...