Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


How to properly direct SourceTree to use Git in the Git for Windows SDK?


Most Git users on Windows are probably using Git for Windows.

That great application is built upon the Git for Windows SDK.  Optionally, instead of just installing Git for Windows, one may install the Git for Windows SDK, which also provides the MSYS2+MinGW Linux build environment integrated with Windows.

It seems that when installing SourceTree, it now has trouble finding or recognizing how to use Git when it is located in an install of the Git for Windows SDK.  (This did not seem to be a problem in the past.  I've been using the older versions of SourceTree with the GfW SDK for a very long while before now.)

I have two related questions about getting the new SourceTree to properly use Git from the Git for Windows SDK.

1) Sometimes during installation SourceTree admits it doesn't recognize where Git is on the system.  So it asks where it is.  The proper response is not clear.  Even supposing it wants to know where git.exe is, which of the following possibilities might be the one most appropriate for SourceTree's need?


2) Since I had been observing fragile behavior and failures on startup for the new SourceTree, I thought I would try making a different selection than I did previously.  However, at the moment, after the latest reinstall of SourceTree, it seems to just assume I'm using system Git that is "LibGit2Sharp" (an interface to libgit2 for Visual Studio .NET)!  I see no way to tell it that I want to point it to a different location of Git.  Is there any way at all in the SourceTree Tools / Options for Git to say, "Let me point you to Git"?  I see only the options of Embedded or else the choice it's made of LibGit2Sharp.

p.s. I'm trying to use SourceTreeSetup-, which I downloaded fresh from just to be sure it was the very latest.

p.p.s. Regarding my first question, I will point out that the git.exe applications in these two locations are currently binary identical.


Likewise, these two applications are also binary identical with each other (but different from the previous two).


(The other two applications in the list of six are each unique.
C:\git-sdk-64\cmd\git.exe is by far the smallest and
C:\git-sdk-64\usr\src\git\git.exe is by far the largest.

Yet, even if two choices are identical files, I do not know whether or not there are unexpected ramifications of choosing one or the other.  As far as I know, even when two copies of an application are identical, there still might be different implications for choosing one or the other, for example, if SourceTree expects certain other files to be present in the same directory as the git.exe application it wants to know about.

1 answer

1 accepted

1 vote
Answer accepted
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 02, 2017


So the short answer is we don't formally support that style of Git install, we have a similar arms length approach to Cygwin installs of Git.

However this information may be of use to you and others.

Sourcetree expects to use the cmd/git.exe version of git.exe.
When Sourcetree starts it tries to find a system install of git by looking for a git.exe in

  • the PATH
  • known install folders in c:\program files*\

If it can't find a system git install it will, depending on situation, download and install an embedded copy or prompt the user to manually find the git.exe.

Because the user might find bin/git.exe or one of the others, when Sourcetree is presented with a git.exe it will attempt to walk the local folder structure to find cmd/git.exe

If it does it checks the git version and if all is good it will configure itself to use and remember that Git install.

So, provided the SDK folder structure mirrors that of  Git for Windows release, if you point Sourcetree at C:\git-sdk-64\cmd\git.exe it should use it.

Sourcetree should accept any 1.x or 2.x version of Git.



I hope this helps.

"This is a very helpful answer.  Thank you!  ..."

FYI: After I first wrote this reply, I made some small edits.  But after I Published the changed version, the whole reply disappeared from view when I would refresh the page, just as if I had not made any Reply at all.

So I made another Reply with the same content.  Now I see that both versions are finally appearing simultaneously.  Therefore, I am leaving the more complete one in place (see below) and editing this earlier version to alert you to a problem with Publish of an edited Reply.  I realize that issue is a separate matter, but I'm at least explaining what happened.

This is a very helpful answer.  Thank you!  It does clearly answer the first of my two questions.

Regarding my remaining question, you made this statement.

"If it can't find a system git install it will, depending on situation, download and install an embedded copy or prompt the user to manually find the git.exe."

In my early experience of installing the latest version, it did prompt me "to manually find the git.exe."  However, not knowing what you just clarified (thank you), I believe I picked the wrong git.exe.

Now when I reinstall SourceTree it isn't giving me that prompt or the opportunity to make a better pick of git.exe.

That leads to my second question.  Is there any way at all (e.g. in the SourceTree Tools / Options for Git or any other way) to tell SourceTree, "Let me point you to Git"?"

If there isn't any such option now, is there a work around that can force the prompt to occur?

For the future I would suggest as a feature request that there should be a "Let me manually select cmd/git.exe" option.  I can understand there might be reasons you are not (yet?) supporting automatic detection of these alternate installations of Git.  But if so, then I think it would be reasonable to help the users easily be successful in manually finding not just any git.exe, but the cmd/git.exe that SourceTree expects.

Thanks again for your response!

p.s. There is another reason such a feature is needed.  As I indicated, sometimes SourceTree may make a poor choice, such when it chose LibGit2Sharp.  To overrule a poor choice, it would be valuable to be able to say, "Let me show you where cmd/git.exe really is."

Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 03, 2017


Yes the site has the occasional niggle' :)

in ST you should be able to go into the Tools/Options/Git tab and do the following

  1. switch to embedded git, this might involve downloading git.
  2. use the 'clear path cache' option
  3. use the 'use system git' option.
    1. Provided Git isn't found on your PATH or in the standard install locations, which I don't think it will be for you, you should be promoted to browse.

Ultimately this will get written into the %localappdata%/Atlassian/Sourcetree.exe_url_{hash}/

You can, with Sourcetree closed, edit this to set Sourcetree to use a system git


<setting name="GitWhichOne" serializeAs="String">

And then tell it where to find it

<setting name="GitSystemPath" serializeAs="String">


restart Sourcetree and, provided it can successfully run 'cmd/git.exe version'  it should run that version of git.

Like # people like this

Thank you!

1. I did switch to Use Embedded Git.

2. The button to Clear path cache never became enabled, so I didn't use it.

3. I did select Use System Git.  With the vital help you provided above of now knowing I needed to find and use the cmd version of git.exe, I did select that version this time (not the bin version I believe I picked earlier).

The immediate result, even without restarting Sourcetree, is that Sourcetree was once again enabled to open/load my repositories without the errors I was experiencing.  Great!

I am now persuaded that the issue from the start was that I made the wrong selection when I picked a git.exe (probably the one under the bin directory).

Consequently, I think it would be very helpful, whenever Sourcetree prompts for finding git.exe, if it could mention at least a good hint related to cmd.  For example, instead of saying something like "Pick/Select git.exe" it might say "Pick/Select the cmd version of git.exe".  That would be a trivial software change to the prompt string, but even that little clue about which version to pick would be better than no guidance at all.

Thanks again for these helpful answers!

Like Sandeep Shukla likes this

p.s. Actually, I'm still having some problems with Sourcetree crashing.  I've put the information in this issue.

Thank you !! @minnsey  @Eric Anderson reading your question/answers finally I was able to resolve the issue !!!

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events