50

According to https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

The installer includes a command line version of Git as well as the GUI. It also works well with Powershell, and sets up solid credential caching and sane CRLF settings.

When I'm launching the latest download from https://desktop.github.com/, it just runs immediately and does not offer me to install command line version. I checked in cmd by typing git, command is not recognized.

Do GithubDesktop really installed Git command line, if not can I force it to do so somehow ?

Update: I've found the install but cannot access it from Powershell.

user310291
  • 36,946
  • 82
  • 271
  • 487
  • 2
    Note that GitHub team does not recommend using the embedded git executable in place of installing from https://gitforwindows.org/. Reasons here: https://github.com/desktop/desktop/issues/3708#issuecomment-354665183 – aaronsteers May 03 '19 at 22:48

9 Answers9

42

On Windows the latest Electron / unified versions of github desktop has git stored here:

C:\Users\UserName\AppData\Local\GitHubDesktop\app-1.0.5\resources\app\git\cmd\git.exe
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Pondersome
  • 429
  • 1
  • 4
  • 2
  • There should be a GIT BASH icon somewhere, with a cat, which you run the git commands in. Try https://git-for-windows.github.io/ it is very user friendly and maybe you can figure out what is going on with this installation in the process. – capser Oct 27 '17 at 02:43
21

GitHub Desktop team member here

Do GithubDesktop really installed Git command line, if not can I force it to do so somehow ?

We no longer support the "Git Shell" environment you might be thinking of, as we decided to focus our resources on the GUI experience. You can read the discussion and why we decided to drop support here: https://github.com/desktop/desktop/issues/340

If you want a command line Git experience on Windows, Git for Windows is your best bet.

Brendan Forster
  • 2,548
  • 1
  • 24
  • 32
  • 8
    You should really update your website then. It still advertises that Github Desktop installs git for you. Also you still have a setting in Options > Advanced that lets you select your shell, which doesn't actually do anything. – Ryan Wilson Dec 05 '19 at 22:24
  • I'm happy to find those links and get things updated - can you share them? And if you've encountered a problem with the shell integration please report it to the project so we can investigate: https://github.com/desktop/desktop – Brendan Forster Dec 06 '19 at 09:43
  • At the bottom of the main page here https://desktop.github.com/ it mentions shell integrations. The page doesn't mention that it doesn't install git for you and the wording implies this is the only thing needed. – Ryan Wilson Dec 06 '19 at 21:19
  • The information about SSH keys is also out of date if this is no longer provided with the Desktop tool https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent – Will Ayd Jan 02 '20 at 15:24
  • I am reinstalling my workstation and just figured this out... very sad :( – Gabrielius Feb 02 '22 at 11:34
  • 6
    3yrs have passed and the official documentation still misinforms you https://github.com/git-guides/install-git#install-git-using-github-desktop – Alexandru Cristian Feb 21 '22 at 10:43
  • 2
    Another year, I happened to read this and was amazed. – GreenAsJade Mar 23 '23 at 22:50
11

EDIT: Below answer is now outdated. Please see Brendan Forster's answer as to why and a proposed alternative.

GithubDesktop install a Git shell with their desktop application. It seem to be locate in a same directory than their RIA application.

If you have a shortcut created by installer GitHubDesktop you can retrieve the git shell location.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
miltone
  • 4,416
  • 11
  • 42
  • 76
3

If you are looking for the command line version of GIT with powershell and not CMD prompt like I was then this might help you.

Github Desktop was changed from Chocolate-Covered Yaks (newest version 3.3.4.0) to a new native desktop which was redesigned with Electron. (It uses git version 2.11.0.windows.3)

Unfortunately the new Github Desktop does not (yet) include a right click option to start PowerShell, like the old version did.

So if you are stuck with the old Github Desktop Chocolate-Covered Yaks because you like the powershell option and you want to upgrade to a newer version of GIT, then you should look for a folder like this:

Example: C:\Users{Your UserName}\AppData\Local\GitHub\PortableGit_{hex code which changes}\cmd (Example is for windows 7. For windows 10 I believe it is using \bin as folder name instead of \cmd

The folder contains git.exe.

Note this is a DIFFERENT folder placement than the new version of Github Desktop uses, which is why im adding this as an extra answer.

I thought I could just replace git.exe with the newest version of git, but when I do that I get

Git version
"error launching git: The system cannot find the path specified."

What in the end worked for me was to simply delete the git.exe from the PortableGit_{hex code which changes}\cmd folder.

Since I had installed the Git separately in the newest version, it seems to default back to that and I get

Git version
git version 2.17.0.windows.1

Note that if you delete the git.exe, Github Desktop v3.3.4.0 will stop working and the only thing you can use it for is to open the shell. For me thats perfect as I use the new Github Desktop anyways for anything but opening the shell.

I also wanted to change editor. It is NOT enough to just install the new version of git and select notepad as editor. Somehow the powershell opened by the old Github Desktop still had its core.editor set to vim.

I fixed it by typing the following in the power shell:

git config core.editor "'C:\Program Files (x86)\Notepad++\notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

2

Goto Preferences an choose your Git-Shell. Thats it. Under default Shell you can choose between: CMD, Git Bash, Powershell or Custom.

2

git wants to simplify things so if you don't confortable with command line interface then you try git desktop if you want both command line and desktop GUI then install separate git from This URl https://git-scm.com/

  • I know how to install git command line, but according to the documentation I don't have to go all through the hassle if I install Github Desktop because it would do the command line installation for me including for Powershell. That does not seem true as far as I can see. – user310291 Jan 02 '16 at 12:28
  • As noted above, GitHub team does not recommend using the embedded git executable in place of installing from https://gitforwindows.org/. Reasons here: https://github.com/desktop/desktop/issues/3708#issuecomment-354665183 – aaronsteers May 03 '19 at 22:48
2

Indeed, the latest versions of Github Desktop (I use 2.9.6) on Windows 10 no longer enables:

  • The use of a shell command prompt to directly enter command lines
  • Discarded files placed in the Windows Recycle bin. Which kind of sucks if you want to recover discarded stashed changes, for example.

Here is a hack to enable Git on Windows Command Prompt that works seamlessly with Github Desktop, in the case Git was installed along with GitHub desktop. This is inspired from this thread 'git' is not recognized as an internal or external command, but adapted to the case of GitHub Desktop:

  1. Locate the file git.exe, from the latest release of GitHub Desktop. In my case:

    C:\Users\USERNAME\AppData\Local\GitHubDesktop\app-2.9.6\resources\app\git\cmd
    
  2. Find the location of the GitHub bin folder. In my case:

    C:\Users\USERNAME\AppData\Local\GitHubDesktop\bin
    
  3. Copy these two paths—with no slash at the end—and add them to the User Environment Variables of Windows 10, so they become broadly accessible in the Command Prompt. For this:

  4. Search "Environment Variables" in Windows settings.

  5. In system properties click "Environment Variables..." button

  6. In User variables, click "New"

  7. In Edit Environment Variables, paste both paths.

Now the Git.exe linked to GitHub Desktop is available in Windows Command Prompt. All you have to do is navigate in Command Prompt to the folder where your repository is located and start to git it. (You can first type the command git to verify this works; it summarizes available commands).

This hack even works when GitHub Desktop is opened in parallel to deal with the easy stuff.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Cedrol
  • 161
  • 1
  • 8
1

FWIW back in 2018 there was a post explaining why the GitHub for Windows desktop tool team doesn't encourage / support using their included git executable but instead recommmends to install git directly:

... We made a conscious decision back in the early days of GitHub for Windows to not tamper with your existing environment unless absolutely necessary, and this is one of those cases.

While it seems convenient to do this, it actually introduces a whole lot of problems:

  • the path to our embedded version of Git is tied to the specific version of Desktop - whenever an update is applied, this path will change, leading to potential breakage of anything that is hard-coded to that path (like environment variables)
  • the embedded version of Git we use in Desktop doesn't support terminal features like colorization, pagination and the UNIX toolchain that developers are familiar with, because we want to save space and we don't need them in the app
  • Desktop manages its own credentials using the GIT_ASKPASS environment variable (details here), and simply adding Git to your PATH won't get credentials working in your terminal or app
  • we discourage depending on our version of Git because it's never been officially supported, and how we embed Git is subject to change. An example of that is VSCode. Early on they took a dependency on the Git found in GitHub for Windows for convenience, and this worked okay until you also installed the Electron Desktop version (we support using these side-by-side) which had it's own CLI integration. This combination broke VSCode because they didn't manage the PATH environment variable correctly, and it would continually spawn the Desktop UI. I had to get them to remove this code in disable lookup for GitHub's version of Git microsoft/vscode#35965

We recommend installing Git for Windows and ensuring you check the "add to your PATH" option in it's installer, as both Desktop and VSCode interop nicely with that.

(user shiftkey)

Source: https://github.com/desktop/desktop/issues/3708#issuecomment-354665183

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
  • Thank you for this, I had already noticed the versioning mentioned in your first bullet, and was wondering how to deal with it. The answer, apparently, is Don't. Install Git for Windows directly instead. I just hope it doesn't stomp on the already installed Desktop... – captain puget Jul 20 '22 at 19:17
0

On Linux you can find the github-desktop resources directory by using the find command:

sudo find / -name "github-desktop" -type d

The path of the folder may vary depending on how you installed GitHub Desktop, but it should output a path resembling: /var/lib/flatpak/app/io.github.shiftey.Desktop/x86_64/stable/6492e8caf515d40c94665dee045332a1396962fd0499b676a9c5a24c164b733e/files/github-desktop

From that path you can traverse to the embedded git bin directory by appending /resources/app/git/bin to the end of the path like this: /var/lib/flatpak/app/io.github.shiftey.Desktop/x86_64/stable/6492e8caf515d40c94665dee045332a1396962fd0499b676a9c5a24c164b733e/files/github-desktop/resources/app/git/bin

Braden Steffaniak
  • 2,053
  • 3
  • 25
  • 37