Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

external diff stopped working

External diff stopped working recently for me.  I have beyond compare selected in source tree options, I've tried multiple, win merge, ... no difference.  I have "allow source tree to modify global git config" checked.

But I never see the .gitconfig file updated.  I've manually added diff tools to it and it works from command line.

[difftool "sourcetree"]
    cmd = 'C:\\Program Files\\Beyond Compare 4\\BCompare.exe' \"$LOCAL\" \"$REMOTE\"

I can see beyond compare making the call

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks d
ifftool -y --tool=sourcetree raptor_kubedbg.xml                                 

I can manually run this and it works.  But when running from within sourcetree the process log shows

Unknown merge tool sourcetree
fatal: external diff died, stopping at rcs.raptor.player/Properties/launchSettings.json

I feel like the root of the issue is sourcetree is not writing to the global git config correctly, is it supposed to?

Any suggestions?  Running sourcetree version  3.0.17 beta 2660, was running 3.0.12 I think before this.


5 answers

2 accepted

0 votes
Answer accepted

I've tracked this down to the environment variables HOMEPATH and HOMEDRIVE being incorrect.  I can temporarily fix these and saving the diff app and doing the external diff work as expected.

Now to figure out why those values are incorrect.

One thing is running the same commands outside of sourcetree and they work.  But when running from within sourcetree they don't work, so sourcetree is passing those environment variables into git.

I had the same issue. I think that Sourcetree assumes that %HOMEDRIVE%%HOMEPATH% points to your Windows user folder, where your .gitconfig file typically resides. But I think maybe they should have used %USERPROFILE% instead. My organization had set %HOMEDRIVE%%HOMEPATH% to a network drive location (probably via Active Directory), which caused this problem for me. My workaround was to remap my network drive to my home/user directory (since my organization has since quit using that mapped network drive anyways, but I didn't want to redefine those variables to be safe, since they were probably set by Active Directory). I remapped it in cmd with the command "subst [drive to map] %USERPROFILE%", then closed and re-opened Sourcetree, changed my diff/merge tool at that point, which successfully updated my .gitconfig (finally!). And then I also noticed that even after Sourcetree updated my .gitconfig, I still needed to keep that drive mapped (i.e. have homedrive/homepath point to my user folder) for the external diff/merge to continue to work.

0 votes
Answer accepted
bgannin Atlassian Team Jan 02, 2019

Hi Scott,

Beta discussions should be on the mailing list and bug reports can go in the bug tracker per the list intro.


Brian Ganninger
Senior Mac Developer, Sourcetree

I updated to the beta to see if it made any difference, it didn't. Using version 3.0.12 now and i'm seeing the issue.

I had the same issue. I use Source Tree 3.1.2 on Windows 10 and want to use CompareIt as external diff tool.

When I set the path in Source Tree, I get the same "Unknown merge tool sourcetree" message in the process output window.

I have two gitconfig files on my PC:

  • c:\Users\<username>\.gitconfig
  • c:\Program Files\Git\mingw64\etc\gitconfig

I don't know where Source Tree keeps the 'Diff Command' settings, but it is not in these files above. When I manually add:

[difftool "sourcetree"]
cmd = 'c:/CompareIt/wincmp3.exe' $LOCAL $REMOTE

to the 2nd gitconfig file (program files/git..) external diff started to work as expected.

Ps: When I go back to Source Tree external diff settings and change the path to something else:

  • the new value is saved in Source Tree
  • gitconfig files are not updated
  • external diff still works with the path defined in 2nd gitconfig file (program files\git..)

I also had issues with SourceTree 3.1.2 on Windows 10. I had several lines like this :

    cmd = 'C:/Program

In section [difftool "sourcetree"] and [mergetool "sourcetree"] in the file  C:\Users\<username>\.gitconfig

After cleaning those lines, I was back to an expected behaviour.

I'm using Beyond Compare 4 and SourceTree 3.3.9 on Windows 10.

I had the same problem - no response after selecting External Diff from SourceTree.

By combining all the answers here, I found that the following lines in the file gitconfig make it work:

[difftool "sourcetree"]
cmd = 'C:\\Program Files\\Beyond Compare 4\\BComp.exe' \"$LOCAL\" \"$REMOTE\"
trustExitCode = true

Note the usage of BComp.exe and the double backslash.

In SourceTree -> Options -> Diff, under "External Diff / Merge, I used the calling to the same .exe file. 

This problem occurs on OSX (macos, mac) too. I'm using high sierra. The issue is ~/.gitconfig is not altered by SourceTree despite the Preferences/General setting, and this file is used even when using the embedded git.

I fixed the problem by modifying ~/.gitconfig for BeyondCompare per :


  tool = bcomp


  prompt = false

[difftool "sourcetree"]

  trustExitCode = true

  cmd = "/usr/local/bin/bcomp" \"$LOCAL\" \"$REMOTE\"

[difftool "bcomp"]

  trustExitCode = true

  cmd = "/usr/local/bin/bcomp" \"$LOCAL\" \"$REMOTE\"


  tool = bcomp


  prompt = false

[mergetool "bcomp"]

  trustExitCode = true

  cmd = "/usr/local/bin/bcomp" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"

[mergetool "soucetree"]

  trustExitCode = true

  cmd = "/usr/local/bin/bcomp" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

7,065 views 5 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you