External diff/merge tool does not launch
Asked by 85e72acf18064:

After update to 3.1.3 version of sourcetree I can't launch external diff/merge tool.

I've tried everything that I could find, but it didn't help much.

I use IntelliJ IDEA tool and set it as follows in Tools -\> Options -\> Diff -\> External Diff/Merge section:

![1.jpg](/t5/image/serverpage/image-id/56370iF47E865D8E236BD1/image-size/large?v=v2&px=999 "1.jpg")![2.jpg](/t5/image/serverpage/image-id/56371iF4A590574E6EBEDB/image-size/large?v=v2&px=999 "2.jpg")**.gitconfig file**:

```
[diff]
tool = sourcetree
[difftool "sourcetree"]
cmd = 'C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2019.1.3/bin/idea64.exe' diff $LOCAL $REMOTE
[merge]
tool = sourcetree
[mergetool "sourcetree"]
cmd = 'C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2019.1.3/bin/idea64.exe' merge $LOCAL $REMOTE $BASE $MERGED
trustExitCode = true 
```

When I try to launch external diff tool by RMC -\> External Diff in Process Viewer I see the following:

![3.jpg](/t5/image/serverpage/image-id/56373i666708D43291219C/image-size/large?v=v2&px=999 "3.jpg")

But when I use git command line:

![4.jpg](/t5/image/serverpage/image-id/56374iEC8970EB96EECFF8/image-size/large?v=v2&px=999 "4.jpg")

press Enter and the tool is opening.

Do anybody know what to do with that?

**UPDATE**

I've tried to change diff/merge tools to another one but error was the same. I've tried to find all gitconfig files and Total Commander gave me few:

![2.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/56647i4CA57E7930ECA454/image-size/large?v=v2&px=999 "2.jpg")

I noticed that when I change anything in tools \> Options none of the gitconfig files are changed and it looks like SourceTree stores settings in a different file.

My setting from the Git tab are:

![1.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/56648iCAB7F7CFAA362AD8/image-size/large?v=v2&px=999 "1.jpg")

I've tried to reinstall SourceTree - did't help


Answers:
author: 85e72acf18064
body: The problem was because of **HOMESHARE** system environment...

In [this](https://community.atlassian.com/t5/Sourcetree-questions/SourceTree-external-diff-tool/qaq-p/35047 "https://community.atlassian.com/t5/Sourcetree-questions/SourceTree-external-diff-tool/qaq-p/35047") topic I found that SourceTree uses the following rules to locate your global git config:

1. HOME, if defined in the global Windows environment (NOT in .profile or similar, only Bash sees that)
2. HOMEDRIVE + HOMEPATH as a first fallback
3. USERPROFILE as a last resort

My HOME variable had a nonexistent path. Although my USERPROFILE varibale was ok the SourceTree didn't want to look for **.gitconfig** file int it.

comments: author: Martin Egholm
body: Still a solution today ?


author: Nikhil Agrawal
body: I'm having the same issues. My fix was in my .gitconfig file. The path to my diff tool wasn't set correctly for some reason.


author: G B
body: In windows 7 external diff suddenly stopped working for no apparent reason.

I upgraded to 3.2.6 to no avail.

In the end it were the wrong quotes**(replace ' by ")** in the .gitconfig file in my home dir (cd \~ in terminal)

**wrong** .gitconfig file:

```
[diff]
tool = sourcetree
[difftool "sourcetree"]
cmd = 'C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2019.1.3/bin/idea64.exe' diff $LOCAL $REMOTE
```

**Correct** .gitconfig file (see the usage of " instead of ' at the cmd lines:

```
[diff]
tool = sourcetree
[difftool "sourcetree"]
cmd = "C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2019.1.3/bin/idea64.exe" diff $LOCAL $REMOTE
```


author: Mike Corsaro
body: Hello! I think this might be caused by the .gitconfig being configured for the system-wide git rather than embedded git. Could you try switching from embedded git to system git under Options \> Git (or verify it's already using system git)?

comments: author: 85e72acf18064
body: Hi, thanks for reply! I've tried switch to embedded git, try use extrenal diff, then back to System git and it didn't help. I've updated my question.

Off-top: It's strange that the latest version from official site is 3.1.2 that wants to update to 3.1.3 after install


author: 85e72acf18064
body: deleted


author: Mike Corsaro
body: Could you check if the setting "Allow Sourcetree to modify your global Git and Mercurial config files" is checked under "Options \> General"?


author: 85e72acf18064
body: Yes, it is checked. Looks like I found a file that changes it is

```
C:\Users\MyUser\AppData\Local\Atlassian\SourceTree.exe_Url_knb5dzyr40klo0lpr3rjuzjrpxfshf5c\3.1.2.3027
```

I looked for all files that contains ( diff \\"$LOCAL\\" \\"$REMOTE\\" ) on the system disk, with the Total Commander search tool and it found only the file above


Tags: diff

merge