IT:AD:Git:HowTo:Install
- See also:
Summary
The problem with 'organic' projects is that it takes time for things to settle down – but old posts hang around forever.
Process
When working on Windows, what you need is the official/endorsed IT:AD:Git For Windows.
When you install it (Q1 2016) it will install Git on a per-user basis to: %userprofile\appdata\local\programs\git
Know something about Environment Variables First
You'll be surprised by how tricky setting a Service Account's Environment Variables can get: * IT:AD:Environment Variables:HowTo:Tips Regarding PATH Notice especially the unintuitive nature of setting Local User Environment Variables…
Configuration: PATH
The installer is not guaranteed to add the Git directory to the PATH environment variable.
Since it's installed on a per-user basis create a User (not System) PATH
IT:AD:Environment Variables that adds the above path.
In fact, add all the following:
%userprofile\appdata\local\programs\git
%userprofile\appdata\local\programs\git\bin
%userprofile\appdata\local\programs\git\usr\bin
(so that Powershell can get to SSH-KEYGEN, etc.
Close and reopen your IT:AD:Powershell CLI (RefreshEnv
is not going to cut it) to see this take effect (type in $env:HOME
to be sure).
Configuration: $HOME environment variable
In Windows you use %userprofile%
to get to your own User directory. But Linux scripts often refer to this directory either by ~
or by $HOME
.
Since Git is mostly developed by Linux users, you need to configure your station to handle this.
Create a User (not System) HOME
IT:AD:Environment Variables that is equal to %userprofile%
.
Close and reopen your IT:AD:Powershell CLI (RefreshEnv
is not going to cut it) to see this take effect (type in $env:HOME
to be sure).
HOME
, not home
…
Installing via Script
Alternatively, you could consider using IT:AD:Chocolatey to install IT:AD:Git
#hack setting version due to: http://stackoverflow.com/a/29305866 choco install git.install -y -version:"1.9.5.20150114" -params:'"/GitAndUnixToolsOnPat"' #choco install "poshgit" -y RefreshEnv
Note that the last time I did this (Q1 2015) the choco installer installed it in a shared directory, not on a per-user basis, so you'll have to factor in all how that changes the PATH requirements.
Check
Check that Git is installed correctly:
git --version