Skip to content

GitHub Desktop does not use some paths from the Git for Windows installation #17801

Closed

Description

@ahmetsait

The problem

Inspecting the environment variables of a git process shows that its PATH variable has these additional paths prepended:

C:\Program Files\Git\mingw64\libexec\git-core
C:\Program Files\Git\mingw64\bin
C:\Program Files\Git\usr\bin

GitHub Desktop should detect installation of Git for Windows and incorporate these paths in its environment to fix issues such as #15974.

In my case, GitHub Desktop fails to show diff for files marked with diff=astextplain attribute because C:\Program Files\Git\usr\bin\astextplain is not found.

Release version

3.3.5 (x64)

Operating system

Windows 10.0.19045

Steps to reproduce the behavior

On a Windows environment with GitHub Desktop and Git for Windows installed:

  1. Create a local git repo with git init.
  2. Add a .gitattributes file with the following line: *.docx diff=astextplain
  3. Add a word.docx file to this repo.
  4. Try to view word.docx diff in GitHub Desktop and see that it gets stuck in loading animation.
  5. Run git diff on command line and see that it works there.

Log files

Developer Tools JS Console

install.ts:28 [AppStore] loading 10 repositories from store
install.ts:28 launching: 3.3.5 (Windows 10.0.19045)
install.ts:28 execPath: 'C:\Users\redacted\AppData\Local\GitHubDesktop\app-3.3.5\GitHubDesktop.exe'
app.tsx:300 App ready time: 63.81909999251366ms
app.tsx:301 Load time: 322.42170000076294ms
app.tsx:302 Renderer ready time: 151.90000000596046ms
spawn.ts:136 Uncaught (in promise) Error: Git returned an unexpected exit code '128' which should be handled by the caller (getWorkingDirectoryDiff).'
    at ChildProcess.<anonymous> (spawn.ts:136:11)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Process.onexit (node:internal/child_process:302:5)
(anonymous) @ spawn.ts:136
emit @ node:events:513
maybeClose @ node:internal/child_process:1091
(anonymous) @ node:internal/child_process:302
await in (anonymous) (async)
_selectWorkingDirectoryFiles @ app-store.ts:2803
selectWorkingDirectoryFiles @ dispatcher.ts:306
onFileSelectionChanged @ sidebar.tsx:185
selectSingleRowAfterMouseEvent @ list.tsx:1371
onRowMouseDown @ list.tsx:1323
onRowMouseDown @ list-row.tsx:117
l @ react-dom.production.min.js:14
m @ react-dom.production.min.js:15
(anonymous) @ react-dom.production.min.js:15
x @ react-dom.production.min.js:17
P @ react-dom.production.min.js:18
D @ react-dom.production.min.js:18
N @ react-dom.production.min.js:21
Rn @ react-dom.production.min.js:84
Ta @ react-dom.production.min.js:250
Le @ react-dom.production.min.js:39
Pn @ react-dom.production.min.js:86
(anonymous) @ react-dom.production.min.js:251
t.unstable_runWithPriority @ scheduler.production.min.js:18
Aa @ react-dom.production.min.js:251
An @ react-dom.production.min.js:85

Screenshots

2023-12-01 10-45-24 GitHub Desktop_

Additional context

No response

Activity

  1. ahmetsait commented on Dec 4, 2023

    @ahmetsait
    Author

    Thinking about this a bit more, ideally we should have an option to make GitHub Desktop use the already installed Git on the system instead of the one it comes bundled with, which would allow GitHub Desktop to pick up system-wide gitconfig & gitattributes from C:\Program Files\Git\etc as well as all the tools and scripts Git installation comes with.

  2. niik commented on Dec 20, 2023

    @niik
    Member

    Hey @ahmetsait, thanks for reaching out. GitHub Desktop ships with a bundled version of git as that's the only way we can guarantee consistent behavior for all users regardless of what version of Git they run. Have you tried specifying the full path to the astexplain script in your gitconfig?

  3. added
    more-info-needed
    on Dec 20, 2023
  4. ahmetsait commented on Dec 25, 2023

    @ahmetsait
    Author

    GitHub Desktop behaves different from git diff cmd output so I don't know what consistency you're talking about here. Most people would prefer their git tools to pick up all the configuration from their system wide git installation rather than some bundled thing that particular tool comes with.

    Specifying the full path to astextplain does not solve the problem since astextplain uses a bunch of other scripts such as docx2txt.pl, pdftotext, odt2txt from C:\Program Files\Git\usr\bin and antiword from C:\Program Files\Git\mingw64\bin.

  5. removed
    more-info-needed
    on Dec 25, 2023
  6. tidy-dev commented on Jul 14, 2026

    @tidy-dev
    Contributor
  7. ahmetsait commented on Jul 22, 2026

    @ahmetsait
    Author

    Sweeping bugs under the rug without actually solving anything. Classic.

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