Search code examples
gitversion-controlpathatlassian-sourcetree

I have two versions of Git and old one being used. How can I fix it?


For a historical reason, I have two versions of git on my Windows 10 machine.

$ where git C:\Users\xxxxxxxxx\AppData\Local\Atlassian\SourceTree\git_local\mingw32\bin\git.exe C:\Program Files\Git\cmd\git.exe

The former being used by SourceTree somehow, but it's quite outdated (2.7.4). The latter is up to date (2.17.1.2).

  • How do I uninstall the older version?
  • How do I use the new version for my version control?

I guess it's about PATH setting somewhere, but I have no idea.

This is related, but for other platforms I think. Two versions of git installed, currently using old one, how do I switch?

I looked at this, but did not help. https://confluence.atlassian.com/bitbucketserver/installing-and-upgrading-git-776640906.html#InstallingandupgradingGit-InstallorupgradeGitonWindows


Solution

  • The output of

    echo %PATH%

    included C:\Program Files\Git\cmd, i.e., the new version. So I guess there must be something overriding PATH for SourceTree.

    Then I thought it can be SourceTree preference. Tools > Options > Git tab has Git Version pane, where you can choose either 'Embedded' or 'System'. In my case "Embedded' was chosen. And there is 'Update Embedded' button right next to it. And that button did the job!

    enter image description here

    I realized that the Git version is too old by a notification from SourceTree but it did not tell me where and how to update it.