Skip to content


Install Git on Windows via Chocolatey

This post shows how to use Chocolatey to install Git.


If you do not have Chocolatey, you can install it by following the instructions on You may also see this post for instructions on how to set the Chocolatey cache location.


Install Git

In PowerShell as Administrator:

choco install git --params "/GitAndUnixToolsOnPath /NoAutoCrlf"

Close and open PowerShell, so it can pick the updated PATH environment.


Verify you have git:

git --version
git version

Verify you have ssh:

usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L address] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R address] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

How to use a different cache directory for Chocolatey packages

About Chocolatey

In short, Chocolatey is a package manager for Windows which saves time by automating otherwise manual installation tasks. You can install Chocolatey by following the instructions on

Configure Chocolatey's Cache Folder

For security reasons, Chocolatey installs in C:\ProgramData\chocolatey by default. See Why does Chocolatey install where it does? for more information.

Also by default, Chocolatey will download packages in C:\Users\USERNAME\AppData\Local\Temp\chocolatey which might work or not for you. If you need to use a different folder, you can set the cacheLocation key in C:\ProgramData\chocolatey\config\chocolatey.config to a folder of your choice.

For example, to use C:\ChocolateyCache as a cache folder, add <add key="cacheLocation" value="C:\ChocolateyCache" description="Cache location if not TEMP folder." /> to the chocolatey.config file like this:

<?xml version="1.0" encoding="utf-8"?>
<chocolatey xmlns:xsd="" xmlns:xsi="">
    <add key="cacheLocation" value="C:/ChocolateyCache" description="Cache location if not TEMP folder." />
    <add key="containsLegacyPackageInstalls" value="true" description="Install has packages installed prior to 0.9.9 series." />
    <add key="commandExecutionTimeoutSeconds" value="2700" description="Default timeout for command execution." />
    <add key="proxy" value="" description="Explicit proxy location." />
    <add key="proxyUser" value="" description="Optional proxy user." />
    <add key="proxyPassword" value="" description="Optional proxy password. Encrypted." />
    <source id="chocolatey" value="" disabled="false" priority="0" />
    <feature name="checksumFiles" enabled="true" setExplicitly="false" description="Checksum files when pulled in from internet (based on package)." />
    <feature name="autoUninstaller" enabled="false" setExplicitly="false" description="Uninstall from programs and features without requiring an explicit uninstall script." />
    <feature name="allowGlobalConfirmation" enabled="false" setExplicitly="false" description="Prompt for confirmation in scripts or bypass." />
    <feature name="failOnAutoUninstaller" enabled="false" setExplicitly="false" description="Fail if automatic uninstaller fails." />
  <apiKeys />