dugite: Git could not be found when running in electron
Git is installed, but am unable to use dugite in an electron-renderer process.
Git could not be found. This is most likely a problem in dugite itself
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 36 (16 by maintainers)
Commits related to this issue
- fix dugite pack see https://github.com/desktop/dugite/issues/96 — committed to gengjiawen/dugite-vue by gengjiawen 7 years ago
- fix: assign LOCAL_GIT_DIRECTORY to point to actural git folder in packaged electron https://github.com/desktop/dugite/issues/96 — committed to tiddly-gittly/TidGi-Desktop by linonetwo 3 years ago
I was getting a similar error -
Git could not be found at the expected path
, building electron with webpack using theelectron-renderer
target. This is due to the__dirname
variable being set incorrectly. I fixed it by adding the following setting to my webpack config.Webpack mocks
__dirname
by default resulting in just a/
. True compiles__dirname
to a string of the context path, and false leaves__dirname
as it is in node.@waltonseymour apologies for the delay on this. There’s an internal check that if we don’t find Git at the expected path, but of course we don’t actually include that path in the error message 🤦♂️ .
We expect Git to be installed at
node_modules/dugite/git/
relative to your application root, but the subdirectory path to thegit
executable depend on the platform you’re running on.I’ve opened #96 to add this diagnostic message, and
1.29.0
is up on NPM which has this change. Let me know how this changes the behaviour for you.I expect there’s some extra work here (like how we move the Git install around at package time) that you might need to do, but this should be a good first step.