4

I installed GitHub Desktop, but it doesn't seem to have successfully set up the git command on the command line. When I try to call git, cmd gives me the error,

'git' is not recognized as an internal or external command, operable program or batch file.

The following path was added to my environment variables; is there some way I should edit this to make git work in cmd?

C:\Users\Me\AppData\Local\GitHubDesktop\bin

2 Answers2

0

Find the git.exe file using WHERE git. This is the directory that should be added to your PATH environment variable.

WHERE git

Mine is in C:\Program Files\Git\cmd\git.exe.

I have C:\Program Files\Git\cmd added to the PATH environment variable.

lit
  • 14,456
  • 10
  • 65
  • 119
  • 2
    'INFO: Could not find files for the given pattern(s)." Doesn't look like I have git.exe installed. –  Nov 12 '17 at 21:56
  • 1
    Please look under `C:\Program Files` and `C:\Program Files (x86)`. – lit Nov 12 '17 at 21:59
  • 1
    I don't have it in either of those directories. –  Nov 12 '17 at 22:03
  • 1
    Perhaps you do need to install it. – lit Nov 12 '17 at 22:05
  • 2
    It turns out Github Desktop doesn't come with the command line configuration, as it is separate from Git. I just had to separately install git for windows to make it work. –  Nov 12 '17 at 22:10
  • 1
    GitHub Desktop does come with its own git executable; see https://stackoverflow.com/a/46966548/1843329 . I've never tried using that executable directly from the command line myself, but it might work without you having to download Git for Windows separately. – snark Aug 08 '19 at 13:20
  • GitHub Desktop comes with an old version of Git. I added its location to PATH, so that VS Code could find it, but VS Code recommended using a newer version of Git. – AlexM Nov 09 '22 at 14:29
0

In Git Desktop, the Git executable path is not directly exposed or configurable within the application itself. Git Desktop installs Git in its own installation directory and manages the Git installation internally, making it accessible to Git Desktop and other Git-related operations performed through the application.

Here are the default installation paths for Git Desktop on Windows:

C:\Users\YourUsername\AppData\Local\GitHubDesktop\app-<version>\resources\app\git\

Replace YourUsername with your actual username and with the specific version of Git Desktop installed on your system.

Add the following paths to Path following these steps:

  1. Search for and open "edit system environment variable".
  2. Go to Environment Variables.
  3. In User Variables double-click on "Path"-->"New" and add:
    C:\Users\YourUsername\AppData\Local\GitHubDesktop\app-<version>\resources\app\git\cmd
  4. In system variables, double-click "Path"-->"New" and add: C:\Users\YourUsername\AppData\Local\GitHubDesktop\app-<version>\resources\app\git\usr\bin\
  5. In terminal, enter git --version to check if it's working.
Ash
  • 1
  • 2