-
Notifications
You must be signed in to change notification settings - Fork 269
Git Executable Detection
Michael Hutchison edited this page Sep 2, 2019
·
2 revisions
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:
- 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.
- 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. - Depending on the platform returned by Node.js:
-
darwin
(Mac & Linux): Runs the commandwhich 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']
-
- 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"
)
- It is the path and file name of a Git executable (e.g.
- 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)
- For example:
If you have any questions about the content of this page, or anything related to Git Graph, please chat with us on Discord!
General Information:
Release Information:
Contributing Information:
If you have any questions about Git Graph, please chat with us on Discord!