Skip to content

What are we gonna do about Git Shell on Windows #340

Closed

Description

@niik

GitHub for Windows has always shipped with a complete git/bash command line environment. It's always been a big selling point, "the easiest way to get git running on your windows machine". We shared that user-facing environment with the app itself, shelling out for the stuff we couldn't do with libgit2. That has once or twice caused us problems when upgrading since the shell environment could break the ui.

Mac has also shipped with git but their environment has only been used internally by the app and hasn't been made publicly available. A long time ago there was a button in the app to install a command line environment but that was removed after Apple started shipping Git shims in 10.9.

Right now desktop ships with a slimmed down environment for both Mac and Windows which is only meant to be used internally. We need to figure out what we need to do as far as providing a shell environment for users on Windows.

Access to a command line environment is essential for things like conflicts where we currently need to tell the user to go resolve the conflicts themselves. GHfW default cop-out when we hit an unexpected error with git was to let the user launch the shell and figure it out from there (not saying I ever liked that).

Questions

  1. How do we ship it? Exactly as we do today? 7-zip archive unpacked to magic dir and environment launched through GitHub.exe?
  2. What kind of interoperability do we want between our internal env and git shell (see How should we handle git authentication? #184)
  3. Do we want to keep shipping posh-git
  4. Do we want to allow custom shells in options like we do today

Goals

  1. Provide a super simple way to get Git onto your Windows machine
  2. Provide an opinionated environment with sane defaults and credential support

I know there was talk about a standalone shell thing a while back but I don't know how fleshed out that really was nor do I know if we have time to go for anything other than parity here.

I know this is something near and dear to @shiftkey's heart and I expect him to have a lot to say here, I'm only opening it so that we can start discussing it.

Activity

  1. shiftkey commented on Sep 13, 2016

    @shiftkey
    Member

    Thanks for opening this @niik ✨

    Some initial thoughts on my side:

    "the easiest way to get git running on your windows machine"

    I'm still very much a fan of this goal. With the change to using an embedded Git for both platforms, this means we no longer need to have this available to users at the very beginning, which makes this an opportunity to do something different.

    I'm very much 👍 on ensuring we interoperate with the embedded Git that we ship in TNG - @niik raised some excellent points in #184 (comment) about the implementation, which we need to think about, but I wanted to approach this from the big picture.

    Continue to have an in-the-box experience

    This could look a lot like what we have now, with "Open in Git Shell" shortcuts to make it easy for people to jump out of the GUI and into a shell. It's more work for us to manage and maintain, but gives us full control over the experience. This has significant interest from our Windows audience, especially going back to The Bad Old Days.

    We've a bunch of experience with tweaking Git to take away friction (think Enterprise environment with certificates in the Certificate Store, and having those mirrored so libcurl works fine). This is the sort of friction we've loved to 🔥 over the years, irrespective of the user's experience with Git. Having all of this in one location is really neat.

    We also have machine-wide installs supported out of the box with TNG, so a machine-wide Git Shell experience is now achievable.

    Extract Git Shell component into it's own project

    We have an installer size currently of ~70MB on macOS and 85MB on Windows.

    I'd love to keep this number as lean as possible, and having optional components would be one way to achieve that. For some beginners, they might have no interest in touching the command line. For others, they might want to "graduate" to the command line, so being able to install Git Shell at some point in the future would be appealing.

    There's a few places we expose Git Shell in the current Desktop (the "Open in Git Shell" context menu being the most prominent) and we could conditionally enable these when they have this other component installed. But we're now stumbling into cross-platform territory here, so these thoughts are going to need some Product™ rubbed on it - cc @pmn @saraford.

    But moving Git Shell out to a separate project means it can move at it's own pace, and others could contribute to it. How we would manage that, and ensure compatibility with Desktop:TNG, is something to think about.

    I also have concerns about duplicating work and taking away from contributions to Git for Windows, but if we're focused on userland features that GfW never intends to support then I think it's a think that deserves to exist.

    Drop Git Shell, Recommend Git for Windows Instead

    This is likely the most radical of the options, and while I had some initial excitement about the potential for this I've kind of mellowed on it recently.

    @dscho was open to enhancing Git for Windows to support things that we support in Git Shell, like Git LFS and PowerShell, but this kind of stalled when Git LFS added 10MB to the install size due to how golang generates binaries git-for-windows/build-extra#110. This should be improved in a future release of Go, but for now it's on hold.

    There's other features like git-tfs we currently support that he's not really interested in adding, but I think with the new version of Desktop we should re-evaluate what we need from a shell environment.

  2. haacked commented on Sep 13, 2016

    @haacked
    Contributor

    I tend to lean towards adopting Git for Windows and having our "Open in Git Shell" download and install it if it isn't already on the machine. The primary reason for this is they're heavily promoting Git for Windows and I think it's going to be a source of confusion if we continue to have our Shell and they have their shells and the two shells interact in some ways but not others.

    But this all depends on what the current discrepancies are between what our shell does and what theirs does. For reference, here's a list of all the customizations we make https://gist.github.com/Haacked/d0dd3b896b941a33e093 in our Git Shell.

    One problem we've had historically has to do with certs as @shiftkey pointed out:

    CERTS: We export the windows cert store to the msys certificate bundle file at startup to %LocalAppData%\GitHub\PortableGit_{SHA}\mingw32\ssl\certs\ca-bundle-ghfw.crt. Msysgit uses curl compiled without support for schannel (the windows ssl lib) so that's why we have to jump through the hoops a bit.
    RECOMMENDATION: Git-for-Windows should include a libcurl that has proper support for Windows Certificate store. This requires building libcurl with SChannel, but apparently there's been problems trying that. So we should probably fix this.

    I'm not sure whether or not the recommendation has happened or not. If it has, it's not clear what other important differences remain.

  3. shiftkey commented on Sep 14, 2016

    @shiftkey
    Member

    I tend to lean towards adopting Git for Windows and having our "Open in Git Shell" download and install it if it isn't already on the machine. The primary reason for this is they're heavily promoting Git for Windows and I think it's going to be a source of confusion if we continue to have our Shell and they have their shells and the two shells interact in some ways but not others.

    Would it be worth catching up with @dscho to get his feels on this? I'm long overdue to catch up with him as-is.

    I'm not sure whether or not the recommendation has happened or not. If it has, it's not clear what other important differences remain.

    No change for this. Launching ssh-agent.exe on startup, integrating posh-git and bigger dependencies like git-lfs are also things that I don't think will easily land in Git For Windows currently.

  4. haacked commented on Sep 14, 2016

    @haacked
    Contributor

    Launching ssh-agent.exe on startup, integrating posh-git and bigger dependencies like git-lfs are also things that I don't think will easily land in Git For Windows currently.

    A hybrid approach is another possibility. The "Git Shell" shortcut we add to the desktop simply is a "launcher" for Git for Windows which does the few steps you mentioned.

  5. joshaber commented on Nov 10, 2016

    @joshaber
    Contributor

    This seems like a big unknown still.

    I tend to lean towards adopting Git for Windows and having our "Open in Git Shell" download and install it if it isn't already on the machine. The primary reason for this is they're heavily promoting Git for Windows and I think it's going to be a source of confusion if we continue to have our Shell and they have their shells and the two shells interact in some ways but not others.

    My literal two cents is that this seems sensible to me. If Microsoft is investing in making Git work well on Windows, it seems like we should run with that. But you all know this world way better than I do.

  6. shiftkey commented on Nov 30, 2016

    @shiftkey
    Member

    Current Status

    To drop Git Shell and just use Git For Windows, these things are currently needed in Git for Windows:

    • Git LFS support - this adds significantly to the installer size, and no plans to take it in
    • Posh-Git support - there's some promising work around supporting machine-wide profiles in Posh-Git, but this causes issues with ssh-agent needing to be relaunched between updates (@dscho seems to think this is a potential can of interoperability worms)
    • certificate synchronizing - MSFT don't seem to care about this, and curl doesn't seem to have the ability to support resolving from the Windows Certificate Store (using winssl), alongside using the CA bundle (using openssl). Perhaps we could test whether building with winssl would be an is an option here, but this means we're diverging from Git for Windows behaviour.

    I don't see these being resolved in time for the beta or 1.0, sadly...

    A Proof Of Concept Ship

    I sat down yesterday to put together a little demo of what I had in mind:

    • first, grab a vanilla Git for Windows release and install it
    • then, drop two executables into the root of the repository. This is just some code borrowed from GitHub Desktop to do two things:
      • git-shell.exe replaces our existing shortcut, now at a known location other tools can interoperate with it
      • git-shell-options.exe is a simple UI to let users change settings that were previously included in GitHub Desktop maybe we don't even need this

    git-shell.exe takes care of the pre-requisites that are needed before launching the user's desired shell. Currently I just have support for certificate importing reusing the Desktop Windows C# code (writes a new file to %PROGRAMDATA% and then sets the current user's global http.sslcainfo value) and it then launches Git Bash.

    Here, watch (it's the window that flashes up in between - I should hide that):

    Anyway, what I'd love to do to finish up this demo is complete this flow:

    • user clicks shortcut on desktop
    • certificates are applied and config updated
    • wireup posh-git (whether that's per-user or machine-wide, I'd need to experiment)
    • user sees PowerShell prompt
    • bundle this up into an installer that extends Git for Windows

    The big unknown I haven't tackled yet is authentication - ideally I'd love to reuse whatever's been defined for GitHub Desktop:TNG but if we can cheat and reuse the GIT_ASKPASS here that'd be ✨

    By also moving to an external component, we need to manage updating ourselves. That sucks, I'd need to think about how we should tackle that...

    Thoughts?

    EDIT: to further simplify things, we could use ~/.gitconfig and a custom config section rather than create a UI and backing store.

    For example:

    [git-shell]
    shell=powershell
    startDirectory=C:/users/shiftkey/Documents/GitHub
    
  7. joshaber commented on Nov 30, 2016

    @joshaber
    Contributor

    Thanks @shiftkey! I think I'm slowly understanding some of these words 😂

    I'll preface all this by again reiterating that my opinions aren't terribly informed. I'm still trying to wrap my head around what we need for Desktop TNG itself vs. what we've provided historically for users because we're nice.

    So lemme take a shot at splitting this up:

    Desktop

    Git LFS support

    Desktop is fine on this front since it's included in git-kitchen-sink.

    Posh-Git support

    Desktop doesn't need this.

    certificate synchronizing

    Desktop will need to do this for itself.

    Git Shell

    Git LFS support

    Is it hard to install Git LFS on Windows? Can users do it themselves?

    Posh-Git support

    My understanding is that Posh-Git is git shell integration. Is that right? Do we need to install that for users?

    certificate synchronizing

    I'm not sure I understand why Microsoft doesn't see this as a bigger deal for Git for Windows. Do they expect people to manage this themselves?


    So all that said, the question I keep coming back to is: is Git Shell still truly necessary?

    On Mac, users are on their own to install Git LFS and any shell integrations they want. I understand Mac users are different from Windows users, but I don't really know how to quantify that.

    On Windows, if users can install Git LFS and shell integrations themselves, that just leaves the certificate synchronizing problem. If Desktop solves that, then we tell users to use that or go bother Microsoft. Maybe down the road we either try to convince Microsoft to solve it, or write our own little standalone thingy.

    @pmn @saraford I'd be curious to hear your thoughts from a Product perspective.

  8. shiftkey commented on Nov 30, 2016

    @shiftkey
    Member

    @joshaber

    re: Desktop features - your list is accurate. I've opened #706 to track the certificate synchronizing.

    Is it hard to install Git LFS on Windows? Can users do it themselves?

    There is an installer. I've not used it.

    My understanding is that Posh-Git is git shell integration. Is that right?

    This is something that Desktop configured for the user behind the scenes. It can be installed via a PowerShell package manager named PsGet but I've not tried it.

    I'm not sure I understand why Microsoft doesn't see this as a bigger deal for Git for Windows. Do they expect people to manage this themselves?

    Me either. This caught me by surprise, and I pity anyone who goes through the work trying to fix it for their setup - let alone at any sort of scale.

  9. saraford commented on Nov 30, 2016

    @saraford

    tl;dr - if someone can help answer my newbie questions, I'll help as much as I can!

    From a Product perspective ™️, first I'm a big 👍 to keeping the tagline "The easiest way to get git running on your windows machine." I'll be honest here and admit (impostor syndrome be damned) that I'm unclear what the differences are between Git Shell, Posh-Git, and Git for Windows. All I know is once I install Windows, I need to install Desktop and everything "just works" enough for me to be productive.

    I'd love to help so I can learn about this stuff and go out and do my tech evangelism thing! Seriously though, my fresh perspective and ability to represent our targeted audience :) could be beneficial in understanding these trade-offs in user experience.

    But first, I'd need to ask a lot questions, mostly around the end-user scenarios, e.g. who are all the types of users we're trying to solve for, e.g non-2FA, 2FA-enabled, users with the certificate synchronizing problem? And btw, what is the certificate synchronizing problem?

    What's the best way to go about this? Should I just ask my PM questions here in this thread? Zoom chat with someone and leave notes somewhere? Let me know!

  10. haacked commented on Nov 30, 2016

    @haacked
    Contributor

    MSFT don't seem to care about this

    @shiftkey - is there an email thread or discussion where they said this? I could raise this up with Jamie Cool and see if he has any thoughts.

    From a Product perspective ™️, first I'm a big 👍 to keeping the tagline "The easiest way to get git running on your windows machine."

    I'm also a big thumbs up to this. From talking to customers, this is a huge benefit of installing Desktop. Windows users in general don't like fiddling around with shell environments and learning all the things to install. They like that we set up a pretty sweet environment for them.

    Not to mention that I would think we still want to support the "Open Git Shell" here feature in Desktop and the Doom Mode ~ feature. Those would require that there's a Git shell on the machine.

    My understanding is that Posh-Git is git shell integration. Is that right?

    Yeah, it provides a nice Git experience within PowerShell. Starting with the next version of Windows 10, PowerShell will be the default shell in Windows.

    It's not too hard to install manually from within PowerShell.

    Set-ExecutionPolicy Bypass -Scope Process
    (new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
    install-module posh-git
    

    Then to keep it updated, you run update-module posh-git from time to time.

    The challenge is that most people new to Git or GitHub (and even experienced folks) won't know to do this.

    Having said all this, it doesn't necessarily mean we have to build our own Git Shell distribution package. Perhaps the first time the user tries to "Open Git Shell", we simply provide them a screen with a download link and instructions to install Git for Windows and Posh-Git. That would be the lowest level of support.

    If we wanted to help them more, we could offer to download Git for Windows and install it for them and configure Posh-Git for them (with an option to uncheck posh-git). There'd be nothing for us to package with Desktop in that case.

  11. shiftkey commented on Nov 30, 2016

    @shiftkey
    Member

    @haacked this has been myself and @dscho going back and forth via Twitter DMs. Actual quote:

    I am not aware of any plans on MSFT's side.

    I'm happy to summarize this discussion if you want to bring it to someone else's attention on the MSFT side.

  12. haacked commented on Nov 30, 2016

    @haacked
    Contributor

    I'm happy to summarize this discussion if you want to bring it to someone else's attention on the MSFT side.

    Yes please! I want to make sure I can thoroughly communicate to Microsoft why this is a problem for them as much as it is for us.

  13. shiftkey commented on Dec 1, 2016

    @shiftkey
    Member

    @haacked here's the summary

    Git for Windows currently uses curl for it's network functionality - this is currently compiled against openssl for the TLS/SSL handshaking. If you're compiling curl with support for openssl, it will look for certificates on disk - either a bundle file at a given location, or a folder containing a number of .pem files. Git for Windows ships with a pre-defined list of certificates, and you can change this configuration value within Git.

    curl also has support for compiling against Schannel on Windows (winssl) or SecureTransport on macOS, which would then use the APIs that the OS makes available, rather than looking for the CA bundle or folder. This means any custom certificates that a user has installed on the machine are used. We currently workaround this issue in GitHub Desktop by synchronizing certificates to a unified certificate bundle to ensure certificates from the Windows Certificate Store are available when openssl performs it's handshaking.

    I'm not aware of specific reasons that Git for Windows avoids compiling against winssl, but if there are Microsoft customers using custom certificates (or even self-signed certificates) in their environments, while also using Git for Windows (particularly now it's a part of VS2017) then they're likely to face the same issue we have worked around.

    I've not looked at the version of Git that is in VS2017 to confirm they will face the same issue. I'll get a test VM setup in the background while working on other things.

    EDIT: yep, the version of Git for Windows is using openssl

    * successfully set certificate verify locations:
    *   CAfile: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\fe4hadgw.ex1\Git\mingw3
    2/ssl/certs/ca-bundle.crt
    
  14. joshaber commented on Dec 1, 2016

    @joshaber
    Contributor

    curl also has support for compiling against Schannel on Windows (winssl)

    So curl already supports it, Git for Windows would just need to change how they compile curl? 😮

  15. shiftkey commented on Dec 1, 2016

    @shiftkey
    Member

    @joshaber yep, but apparently @dscho isn't keen to do this for backwards-compatibility reasons 😞

  16. 25 remaining items

  17. patrikhuber commented on Oct 2, 2017

    @patrikhuber

    here's the ones that we bundled with Git Shell.

    Ah that's awesome! Will add these to my setup, thanks :-)

    It really is quite a pain getting the same setup again like one had before with the GHFW "Git Shell"! Even once one finds this thread. But I think I'm there now.

  18. SteveALee commented on Nov 3, 2017

    @SteveALee

    Here's a few comments from a user who immeditely noticed the missing shell when installing lastest.

    I actually dont use GitHub Desktop much, it's more a quick way to install a bash on windows, as you mention. These days i mostly use VS Code's built in git support and the git lense extension, plus occaisional command line.

    GitHub Desktop does still give me two useful things a) a one click clone from github website b) a nice GUI experience when I feel the need for it.

    I've actually been using various bash envs on Windows for years and settled on Git4Windows (MinGW MSys based). I found you used to supply it soI could install both in one go, nice. Lately I saw references to cygwin which was surprising, but you indicate above you customise your version. I tend to use a pretty vannila git setup so don't often hit config issues

    The way of git is every now and then you get into a mess and need to switch to incantation and prayer operational mode on the command line. The likely hood of this is reduced when using wrappers like GitHub Desktop, but it can still happend. Thus you do need to supply a CLI env to drop down into, and as observed it need to be configured to match GH Desktop.

    Now WSL has largely stabilised perhaps you could use that? But that's only usable on latest Windows update and then syncing of links / Junction is not fully sorted. Probably to complext to config from a windows installer anyway.

    Finally when you removed the shell you also seem to remove tha ability to set the directory that repos live in. That's also a deal breaker for me. We still have programs that have path limits.

    I hope that is vaguely useful

  19. SteveALee commented on Nov 3, 2017

    @SteveALee

    Oh PS, my bash config includes a SSH Agent so I don't have to keep supplying HTTP passwords.

  20. gethub0100 commented on Dec 14, 2017

    @gethub0100
  21. dahlbyk commented on Dec 14, 2017

    @dahlbyk

    FYI, discussion about installing posh-git with Git for Windows: git-for-windows/git#1384

  22. patrikhuber commented on Dec 19, 2017

    @patrikhuber

    Incidentally, I just found this blog post from 2015. It's from @haacked who works at GitHub, explaining why they bundled all this together and how much of an awesome and simple experience it creates on Windows, with useful defaults and all that.
    A bit unfortunate that 1.5 years later most of that simple experience was removed.

  23. tedry commented on Jan 30, 2018

    @tedry

    With out the shell this is incomplete.. I don't bother using the desktop without it.

  24. j-f1 commented on Jan 30, 2018

    @j-f1
    Contributor

    We now recommend using Git for Windows to get access to a Git environment on Windows.

  25. binaryfunt commented on Mar 21, 2018

    @binaryfunt

    I've created a couple of scripts that allow you to load the old version of GitHub's posh-git module into your current PowerShell session: github.com/binaryfunt/git-shell. There's a bit of overhead in setting it up, but I've found it to be exactly what I want.

    Demo

  26. shiftkey commented on Mar 22, 2018

    @shiftkey
    Member

    @binaryfunt I'd recommend just using Posh-Git using one of their install methods as that's been under active development beyond what's currently in classic Desktop.

    If there's other parts of the Git Shell experience you're missing, I can help point you to other resources about that.

  27. binaryfunt commented on Mar 22, 2018

    @binaryfunt

    @shiftkey Yeah I guess most people might prefer to just import posh-git to their powershell profile, but I like the behaviour of having a callable session that automatically cd's to my GitHub directory. Plus as a shortcut git-shell is less characters to type than Import-Module posh-git

  28. locked as resolved and limited conversation to collaborators on Jul 18, 2018
  29. unlocked this conversation on Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions