I was previously using an older version of Sourcetree, and I'd have to keep setting up the external diff tool on every restart of the program. I found a post here that said that was a known issue, and it was fixed in the latest version. So I updated to 3.1.3 for Windows, and while the Tools->Options->Diff menu does remember what I put in there now, it doesn't do anything anymore.
When I try to run one, the Process Log says this:
"Command": "git\r\n-c diff.mnemonicprefix=false -c core.quotepath=false difftool -y --tool=sourcetree be772c0da4337819b46177dcd6ada189b9cbb464^..be772c0da4337819b46177dcd6ada189b9cbb464 --\r\nble/Source/hal_vault.c",
"Output": "Unknown merge tool sourcetree\nfatal: external diff died, stopping at ble/Source/hal_vault.c\n"
I've seen this topic multiple times on here, but none of the solutions seem to be applicable to my situation. I have "Allow Sourcetree to modify your global Git and Mercurial config files" checked. But if I change the tool from within Sourcetree, my .gitconfig file doesn't change. And if I run the command from the log above through the terminal, MINGW64 doesn't give me the error message.
So I don't think Sourcetree knows where my .gitconfig file is located. I found another thread that said it first looks in the path defined by the HOME environment variable; I didn't have one, but I created it, and that still didn't help. So how do I tell Sourcetree where my .gitconfig is, or what other issue am I missing?
Hello! There's multiple locations that your .gitconfig can be located: local, global, and system wide.
Sourcetree sets the diff config at the global level -- which should be located in "C:\Users\USERNAME\.gitconfig". We don't actually look for a file path, but instead tell git to set the config value with the --global flag set.
So for example, this is what my difftool config looks like using TortoiseMerge:
cmd = 'C:/Program Files/TortoiseSVN/bin/TortoiseMerge.exe' \"$LOCAL\" \"$REMOTE\"
prompt = false
cmd = 'C:/Program Files/TortoiseSVN/bin/TortoiseMerge.exe' -base:\"$BASE\" -mine:\"$LOCAL\" -theirs:\"$REMOTE\" -merged:\"$MERGED\"
trustExitCode = true
So now I wonder why git isn't setting the file. Are you using the system-wide install of git, or the embedded install (you can check in Options > Git)?
Could you open the process viewer (Tools > Process Viewer...), set the diff tool, then close the options window. Then look at the process log for an item that looks like this:
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks config --global difftool.sourcetree.cmd
As a work-around, you can save that process log to a file, then find item in the file that contains the command to set the diff tool and run it. I'd be interested in getting a copy of that log too if possible.
"Command": "git -c diff.mnemonicprefix=false -c core.quotepath=false config --global difftool.sourcetree.cmd \"'C:/Program Files/TortoiseHg/lib/kdiff3.exe' \\\"$LOCAL\\\" \\\"$REMOTE\\\"\"",
"Output": "error: could not lock config file U://.gitconfig: No such file or directory\n"
Looks like it's looking for it in a nonexistent U: drive. I mapped U: to my C:\Users\chunt folder and now Sourcetree writes to .gitconfig and launches the external diff. Thank you!
Pretty sure the previous version I upgraded from didn't look there, and it's not getting that drive letter from any Path or environment variables. Let's say I didn't want to have to map the drive though; is there a way to tell Sourcetree not to look in "U:\"? Why does it look there by default?
Well, like I said before, I didn't have a "HOME" environment variable before, and the first thing I tried was to add one and set it to %USERPROFILE%, or at least the literal path. That didn't work; it still tried to find it in "U:\" which didn't exist.
If that's a git thing, odd it doesn't do it from the command line; "git config --global --edit" finds the file in %USERPROFILE% without a "HOME" environment variable and no "U:\" drive mapped.
I'll happily map it again and leave it that way since that makes everything work. But I still don't know where git is getting "U:\" from.
I had the same problem, except git/sourcetree was trying to use H:\ as the drive. I'm using embedded git and I didn't have a HOME environment variable. However, it looks like my computer has the following environment variables:
I think these are set by the network administrator through Active Directory. I don't actually have an H drive.
I created a HOME environment variable and set it to %USERPROFILE% to fix it. I had to restart source tree and unregister/reregister the external diff tools. After that I'm able to use external diffs.
Setting the HOME environment variable got me up and running to! So many hours wasted on this...
@Chris_Hunt- i am having the same issue. Lost 2 hrs to this now.
I don't have a Home environment variable.
The ProcessViewer is telling me it is looking for my global git config file on the Q Drive. I don't have a Q Drive.
When I load gitbash terminal, it is picking up all of my settings from my c drive userprofile location. Which is correct. So I am at a loss here really.
Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...
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