Using Git 2.x - Windows
Problem
SourceTree for Windows currently embeds v1.9.5 of Git, but in principal can use any version of Git, 32-bit or 64-bit, as System Git, that can be found.
SourceTree 'finds' System Git installations by searching for git.exe in the following locations.
- searching the folders defined by the PATH environment variable.
- searching the program files folders
- c:\program files\
- Contains all programs on a 32-bit OS or all 64-bit programs on a 64-bit OS.
- c:\program files (x86)
- Contains all 32-bit programs on a 64-bit OS.
- c:\program files\
For the first git.exe it finds it will extract a Git System Path by stepping up its parent folders, for example
Directory of C:\Program Files (x86)\Git\bin
01/05/2015 00:56 1,504,256 git.exe
gives a Git System Path of
C:\Program Files (x86)\Git
Cause
For the following Git System Path
C:\Program Files\Git
SourceTree will attempt to run git.exe from
C:\Program Files\Git\bin\git.exe
However Git v2.x does not include a bin folder, only cmd
Directory of C:\Program Files\Git
12/05/2015 09:59 <DIR> .
12/05/2015 09:59 <DIR> ..
12/05/2015 09:06 <DIR> cmd
12/05/2015 08:54 <DIR> dev
12/05/2015 09:07 <DIR> etc
07/05/2015 16:14 136,192 git-bash.exe
07/05/2015 16:14 135,680 git-cmd.exe
12/05/2015 08:51 <DIR> mingw64
06/05/2015 09:39 38,702 ReleaseNotes.html
12/05/2015 09:07 <DIR> tmp
12/05/2015 09:07 3,584,926 unins000.dat
12/05/2015 09:04 1,299,217 unins000.exe
12/05/2015 08:51 <DIR> usr
Therefore SourceTree fails to detect and use Git v2.x installations.
Workaround
Use a SymLink to re-create the Git bin folder.
C:\Program Files\Git>mklink /D bin cmd
symbolic link created for bin <<===>> cmd
SourceTree can now find git.exe via the bin folder.
Directory of C:\Program Files\Git
12/05/2015 09:59 <DIR> .
12/05/2015 09:59 <DIR> ..
12/05/2015 09:59 <SYMLINKD> bin [cmd]
12/05/2015 09:06 <DIR> cmd
12/05/2015 08:54 <DIR> dev
12/05/2015 09:07 <DIR> etc
07/05/2015 16:14 136,192 git-bash.exe
07/05/2015 16:14 135,680 git-cmd.exe
12/05/2015 08:51 <DIR> mingw64
06/05/2015 09:39 38,702 ReleaseNotes.html
12/05/2015 09:07 <DIR> tmp
12/05/2015 09:07 3,584,926 unins000.dat
12/05/2015 09:04 1,299,217 unins000.exe
12/05/2015 08:51 <DIR> usr