Skip to content

Add option during install to add git to path in Windows #3708

Closed

Description

@gmcclins

Description

Enhancement request. Add an option during install on Windows to add git provided by desktop to path. This will allow users to also use git from the command line. Also, it will satisfy Visual Basic Codes git check and will allow version control using git.exe provided by desktop from Visual Basic Code.

Current Setup

GitHub Desktop version: 1.0.11

OS: Windows 10 Pro

OS version: Microsoft Windows [Version 10.0.16299.125]

Steps to Reproduce

  1. Add C:\Users\user\AppData\Local\GitHubDesktop\app-1.0.11\resources\app\git\cmd to path

image

  1. You can now use git provided by desktop via powershell, cmd and even in Visual Studio Code

image

image

Additional Information

I'm sure this wouldn't be something everyone wants as you can always install the actual git for windows, but that comes with some config choices. I know I would rather just install desktop to get git functionality in Windows. Since this is something not everyone would want, I'm thinking the best way to implement this would be via adding a checkbox option during install. Something along lines of add git to path.

Not sure this would really make sense on Linux or macOs. Thoughts?

Activity

  1. j-f1 commented on Jan 1, 2018

    @j-f1
    Contributor

    The version of git we bundle has many features removed so we can have a smaller download size. This makes it a poor candidate for use outside of Desktop, since we might remove features of git we don’t use at any time without warning.

  2. shiftkey commented on Jan 1, 2018

    @shiftkey
    Member

    @gmcclins thanks for the suggestion. 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.

  3. j-f1 commented on Jan 1, 2018

    @j-f1
    Contributor

    Would it be possible to / should I open an issue for printing out a warning if you attempt to use the integrated git outside of Desktop?

  4. shiftkey commented on Jan 1, 2018

    @shiftkey
    Member

    @j-f1 nah, I don't think the effort required to do this is worth it

  5. gmcclins commented on Jan 1, 2018

    @gmcclins
    Author

    Thank you for the review and taking the time to explain in detail.

  6. locked as resolved and limited conversation to collaborators on Jul 18, 2018
  7. unlocked this conversation on Sep 27, 2018
  8. gliatrax commented on Mar 21, 2019

    @gliatrax

    Thank you. This was helpful. saved to re-read for later configurations as well.

  9. amjadtbssm commented on Jul 13, 2024

    @amjadtbssm

    I can manually add the path of the git.exe from bin folder and it is working in cmd.exe commands but not by default. There is an option to select the shell in the settings too but all is not working. Why put something that is not working??? Please update or remove the option...

  10. steveward commented on Jul 17, 2024

    @steveward
    Contributor

    @amjadtbssm we don't recommend adding the Git that ships with GitHub Desktop due to it being customized for the app. The shell option in the menu is explicitly to set the shell you want to open from within GitHub Desktop. I hope that helps explain things.

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