Sourcetree Windows 3.1.2 can't find GIT after initial launch
Asked by Randy Meyer:

If I run the installer for Sourcetree Windows 3.1.2, Sourcetree automatically opens and can find GIT, but if I close Sourcetree and restart it Sourcetree can no longer find GIT. At this point all of the options to enable GIT fail. Attempting to use embedded GIT starts the download and install, but the same dialog comes back that Sourcetree can't find GIT. Trying to browse for GIT only results in the same dialog being shown without ever giving me an option to select a location where GIT is installed. If I exit Sourcetree and rerun the installer, Sourcetree is able to automatically find my system GIT or use embedded GIT.

This started when I first used the in app notification to upgrade Sourcetree from 3.0.17 to 3.1.2.

If install 3.1.2 and verify that GIT is enabled and then upgrade to 3.1.3 via the notification, GIT will still work after restarting via the notification as 3.1.3. But again if I exit Sourcetree and relauch it GIT can't be found.

Currently I need to reinstall Sourcetree each time I launch it in order to be able to use GIT, or I can downgrade to Sourcetree 3.0.17 that had no problems finding GIT.


Answers:
author: Mike Corsaro
body: Hello!

Could you try installing [git for windows manually](https://git-scm.com/download/win)? I suspect that there's something odd about your system-wide environment variables, or Sourcetree is not being allowed to access the "C:\\Users\\USERNAME_HERE\\AppData\\Local\\Atlassian" folder which is where the local version of git is installed.

comments: author: Randy Meyer
body: I have had Git for Windows installed. Sourcetree can't find the install and won't let me browse to find it. 3.0.17 works fine using system Git.


author: Mike Corsaro
body: Can you check the version of git that is installed? Open "Tools \> Options \> Git" and scroll to the bottom.

Do you have any specific anti-virus or anything significant that might be preventing Sourcetree from finding git?


author: Mike Corsaro
body: Additionally, could you enable debug logging ([follow the directions here for Windows](https://community.atlassian.com/t5/Sourcetree-articles/Tip-from-the-team-debugging-Sourcetree/ba-p/794778)) and then upload and link your log file (or email it to me @ mcorsaro at atlassian dot com)

Thanks!


author: Randy Meyer
body: Starting with SourceTree 3.0.17  
System Git version 2.22.0 + git-lfs v2.7.2  
Update to SourceTree 3.1.2  
Embedded Git version 2.20.1 + git-lfs v2.6.1  
System Git version 2.22.0 + git-lfs v2.7.2  
Restart SourceTree 3.1.2  
Git not found  

I have Trend Micro and Avecto Defendpoint which I can not disable. They are required as part of our HITRUST certification.

Sourcetree 3.0.17 works with either embedded or system Git.

I turned on debug logging and restarted Sourcetree 3.1.2 and tried to enable Git. I will email you the log file.


author: Mike Corsaro
body: Looking at your log files, it appears that Sourcetree is getting an access denied exception when attempting to run git from your Program Files directory.

It also appears that Sourcetree cannot run git from "C:\\Users\\USERNAME\\AppData\\Local\\Atlassian\\SourceTree\\git_local\\bin\\git.exe" as well. That's fairly annoying... because it's the folder that Sourcetree is installed in ?

Not sure why ST 3.0.17 works -- is there some sort of application whitelisting that Trend Micro or Avecto Defendpoint has that prevents apps from accessing their own folders?


author: Randy Meyer
body: It looks like it was something with the security software blocking it. I had my IT department look at it, and they updated the permissions that Sourcetree runs with. Sourcetree 3.1.2 and 3.1.3 both work correctly now.


author: M Palani Kumaran
body: Hi Randy, I'm facing a similar issue with sourcetree, is it possible you could please let me know what permissions were possibly updated, as this would help me explain my situation to the IT team at my organization. + It would be great if you could send me those log files as well if possible as my logs doesn't seem to be explaining the situation very well. Email id: palanik.4zeracing@gmail.com .

Thanks in Advance


Tags: git

windows