Uploaded image for project: 'Sourcetree for Windows'
  1. Sourcetree for Windows
  2. SRCTREEWIN-7964

Opening repositories fails with System.ComponentModel.Win32Exception: The system cannot find the file specified

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • High
    • None
    • 2.3.1.0
    • None
    • Severity 2 - Major

    Description

      The current version (SourceTreeSetup-2.3.1.0.exe) has become effectively unusable with the Git on my system, which I consider to be major severity.  After uninstalling and freshly reinstalling 2.3.1.0, I get errors of the following kind (and more) when try to open a Git repository directory.

      ERROR [date time] [number] [SourceTree.Diagnostics.FailureHandler] [HandleGeneralTaskFailure] - 'git status' failed with code -1: System.ComponentModel.Win32Exception: The system cannot find the file specified
      (C:\repositoryDirPath)

      Past versions of SourceTree worked fine with the same Git repositories.  As I explain below in the first comment to this issue, I believe the problem may be that SourceTree no longer sees and/or does not correctly use Git on my system.  This is despite the fact that I haven't changed the way that I install Git on my system.

      A principle version of Git on Windows is "Git for Windows".   Obviously SourceTree must work with that version of Git.
      https://git-for-windows.github.io/

      Instead of installing this version directly and minimally, one may instead install the "Git for Windows SDK", which also provides the integrated (MSYS2+MinGW) Linux environment that builds that very same version of Git.
      https://github.com/git-for-windows/build-extra/releases/latest

      If Windows SourceTree is able to work with Git for Windows, it ought to also be able to work with that very same version of Git when it has been created in and by its development SDK environment.  It's the same executable application.

      I've been using the Git for Windows SDK for a long time now.  Until now, past versions of SourceTree were able to work fine using the version of Git in the SDK's directory tree.

      However, currently SourceTree (SourceTreeSetup-2.3.1.0.exe) does not correctly locate and use Git if it is present as part of the Git for Windows SDK.

      • On installation it sometimes confesses it cannot find Git on the system and asks for help locating it (cf. the git.exe list below for why this is not a simple question).
      • I've also had it fail to ask and merely assume it should be using "LibGit2Sharp", which is a .NET interface to libgit2.
      • When trying to open a git repository (something that worked in past versions of SourceTree), it currently fails with errors such as the one I quoted above.
      • See also the first comment about another user's experience with this same exception.

       

      The ideal fix is to correct its ability to locate Git on a Windows system so that it does find and correctly use it when it is located within the SDK's directory tree.

      In the meantime, a possible work around would be to supply directions on how to manually guide SourceTree so that it finds and uses the appropriate copy of git.exe within the Git for Windows SDK.  Since the SDK installs an integrated MSYS2+MinGW environment, there are actually up to six different choices for a relevant git.exe selection.  Some of these are relevant to use by the MSYS2+MinGW simulated Linux environment and therefore not appropriate for SourceTree's selection.

      C:\git-sdk-64\cmd\git.exe
      C:\git-sdk-64\mingw64\bin\git.exe
      C:\git-sdk-64\mingw64\libexec\git-core\git.exe
      C:\git-sdk-64\usr\bin\git.exe
      C:\git-sdk-64\usr\lib\git-core\git.exe
      C:\git-sdk-64\usr\src\git\git.exe

      Here are some differences and similarities between these applications:

      C:\git-sdk-64\cmd\git.exe is by far the smallest.

      C:\git-sdk-64\usr\src\git\git.exe is by far the largest.

      C:\git-sdk-64\mingw64\bin\git.exe
      and
      C:\git-sdk-64\mingw64\libexec\git-core\git.exe
      are binary identical to each other (but may differ as choices in terms of context).

      C:\git-sdk-64\usr\bin\git.exe
      and
      C:\git-sdk-64\usr\lib\git-core\git.exe
      are binary identical to each other (but may differ as choices in terms of context).

      Hopefully it is possible to orient SourceTree to the most appropriate setting for the git.exe that it needs to use.

      p.s. The original summary for this issue was this:

      "Windows SourceTree should work correctly with the Git for Windows SDK"

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              44c2038cbbef Eric Anderson
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated: