# Chocolatey and installing GIT

**URL:** <https://forum.ansible.com/t/chocolatey-and-installing-git/31272>\
**Category:** Ansible Project\
**Created:** [September 12, 2019, 7:27pm UTC](https://forum.ansible.com/t/chocolatey-and-installing-git/31272 "2019-09-12T19:27:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon-Pierre\_Diamond](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Simon-Pierre\_Diamond](https://forum.ansible.com/u/Simon-Pierre_Diamond)\
**Post date:** [September 12, 2019, 7:27pm UTC](https://forum.ansible.com/t/chocolatey-and-installing-git/31272/1 "2019-09-12T19:27:24Z")

</div>

Hi guys,

I am trying to install git with chocolatey using a playbook:

- name: Install GIT

win\_chocolatey:

name: git

state: present

It should be really simple when I run this. It should go through and no issues.

Although this gets quite tricky.

I get the following error when running this:

“stdout\_lines”: [

“Installing the following packages:”,

“git”,

“By installing you accept licenses for the packages.”,

“”,

“git.install v2.23.0 [Approved]”,

“git.install package files install completed. Performing other installation steps.”,

“Using Git LFS”,

“Installing 64-bit git.install…”,

“WARNING: User (you) cancelled the installation.”,

“ERROR: Running ["C:\ProgramData\chocolatey\lib\git.install\tools\Git-2.23.0-64-bit.exe" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /NOCANCEL /SP- /LOG /COMPONENTS="icons,assoc,assoc\_sh,ext,ext\shellhere,ext\guihere,gitlfs,icons\quicklaunch"] was not successful. Exit code was ‘5’. Exit code indicates the following: User (you) cancelled the installation…”,

“git not installed. An error occurred during installation:”,

" Exception of type ‘System.OutOfMemoryException’ was thrown.",

“git package files install completed. Performing other installation steps.”,

“The install of git was NOT successful.”,

“git not installed. An error occurred during installation:”,

" Exception of type ‘System.OutOfMemoryException’ was thrown.",

“”,

“Chocolatey installed 0/2 packages. 2 packages failed.”,

" See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).",

“”,

“Failures”,

" - git.install (exited 5) - Error while running ‘C:\ProgramData\chocolatey\lib\git.install\tools\chocolateyInstall.ps1’.",

" See log for details.",

" - git (exited 1) - git not installed. An error occurred during installation:",

" Exception of type ‘System.OutOfMemoryException’ was thrown."

]

Then when I look at the log, I can see this on the machine:  
12 15:23:06,611 3344 [DEBUG] - Received arguments: install git --fail-on-unfound --yes --no-progress --limit-output --timeout 2700

If I run this manually in Powershell:  
choco install git --fail-on-unfound --yes --no-progress --limit-output --timeout 2700

It works fine and super good.

I can only assume that it is the module. Anybody can help me with this?

-Simon

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [September 13, 2019, 1:12am UTC](https://forum.ansible.com/t/chocolatey-and-installing-git/31272/2 "2019-09-13T01:12:36Z")

</div>

This could be a result of a few things, what I would try is;

- Use win\_command to run ‘choco install git --yes --no-progress’
- If this fails then the error probably lies within the WinRM memory limits placed on a process
- If it doesn’t fail then something might be up with the module
- Check if you can install any other chocolatey packages can be installed
- If not, then something is up with your Chocolatey install- Try running with async, this should escape the WinRM memory limits I mentioned above
- Have a look on the server when running your win\_chocolatey task and see what is taking up all the memory (powershell.exe, choco.exe, or some other exe)  
Thanks

Jordan

---

<div class="post-metadata">

**Author:** ![Simon-Pierre\_Diamond](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Simon-Pierre\_Diamond](https://forum.ansible.com/u/Simon-Pierre_Diamond)\
**Post date:** [September 13, 2019, 11:57am UTC](https://forum.ansible.com/t/chocolatey-and-installing-git/31272/3 "2019-09-13T11:57:32Z")

</div>

You are right Jordan, I could use win\_command instead.

As of now, Git is the only software I need, and wanted it in an automated way, chocolatey was the easiest until that happens…

I will look into all that stuff, thank you, that should give me enough to look at.

Thank you!

-Simon

---

<div class="post-metadata">

**Author:** ![Simon-Pierre\_Diamond](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@Simon-Pierre\_Diamond](https://forum.ansible.com/u/Simon-Pierre_Diamond)\
**Post date:** [September 13, 2019, 12:52pm UTC](https://forum.ansible.com/t/chocolatey-and-installing-git/31272/4 "2019-09-13T12:52:31Z")

</div>

Hi Jordan,

Just for your information,

I guess I did not read the documentation properly, the winrm memory fix helped to run the everything through.

Although, it does not seem to work as expected. In the log I can see " Software installed to ‘C:\Program Files\Git\’"

This is when I run ansible-playbook with verbose.

When I go and look on the server, the files are not present. which gets me wondering.

Also if I run the uninstall manually, it looks like git was not installed.

Anyway, I will probably just run win\_command instead. But I figured I should state the issue here.

-Simon
