vscode-git-graph
  • Welcome
  • General
    • Context Menus
    • Extension Settings
      • Configuring a custom Pull Request Provider
    • Downloading & Installing Releases
    • Git Executable Detection
  • Contributing / Development
    • Contributing
    • Issue Prioritisation
    • Codebase Outline
    • Support Development / Donate
  • Links
    • GitHub Repo
    • Discord
    • Code of Conduct
Powered by GitBook
On this page
  1. General

Git Executable Detection

As Git Graph requires a Git executable to be present on the users computer to run underlying the Git commands, when Visual Studio Code is opened the extension must find it. The following steps are performed by the extension to determine the absolute path of the Git executable:

  1. If Visual Studio Code & Git Graph have previously been opened, the extension will check to see if the last known Git executable still exists. If it does, it will use it. This speeds up the extension start up time.

  2. If the user has manually set the path and file name of a Git executable in the Visual Studio Code setting git.path, the extension checks to see if it is a valid Git executable. If it is, it will use it.

  3. Depending on the platform returned by Node.js:

    • darwin (Mac & Linux): Runs the command which git to determine the absolute path of the Git executable.

    • win32 (Windows): Checks the following directories for the Git executable (matching the Visual Studio Code behaviour), and returns as soon as the first match is found:

      • process.env['ProgramW6432'] + '\Git\cmd\git.exe

      • process.env['ProgramFiles(x86)'] + '\Git\cmd\git.exe

      • process.env['ProgramFiles'] + '\Git\cmd\git.exe

      • process.env['LocalAppData'] + '\Git\cmd\git.exe

      • All directories in process.env['PATH']

Notes

  • If you use git.path, make sure:

    • It is the path and file name of a Git executable (e.g. C:\Program Files\Git\bin\git.exe).

    • Backslashes are correctly escaped for JSON (e.g. "git.path": "C:\\Program Files\\Git\\bin\\git.exe")

  • If you change & save the value of the git.path setting, the extension will automatically check if it's a valid Git executable. If it is, it will use it. Git Graph will display an information or error message dialog indicating whether the Git executable is being used.

  • If you have multiple versions of Git executables on your computer, you can check to see which Git executable is being used by the extension in the log (which is shown in a Visual Studio Code Output Channel).

    • For example: [2019-08-23 09:23:28.691] Using C:\Program Files\Git\cmd\git.exe (version: 2.17.1.windows.2)

PreviousDownloading & Installing ReleasesNextContributing

Last updated 3 years ago