Using Git 2.x - Windows
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
The latest version of SourceTree supports Git 2.6.x as embedded git without the need of this guide.
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.
For the first git.exe it finds it will extract a Git System Path by stepping up its parent folders, for example
1
2
3
Directory of C:\Program Files (x86)\Git\bin
01/05/2015 00:56 1,504,256 git.exe
gives a Git System Path of
1
C:\Program Files (x86)\Git
Cause
SourceTree assumes the git.exe will be located in the bin folder within any installation it finds.
For the following Git System Path
1
C:\Program Files\Git
SourceTree will attempt to run git.exe from
1
C:\Program Files\Git\bin\git.exe
However Git v2.x does not include a bin folder, only cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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.
1
2
C:\Program Files\Git>mklink /D bin cmd
symbolic link created for bin <<===>> cmd
SourceTree can now find git.exe via the bin folder.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
Was this helpful?