how to bundle git with an electron app

2019-07-28 05:01发布

问题:

I am developing an electron application for a client and they need an easy way to update the app as I work on it. I have found that the easiest way is to just include support for pulling from a git repo and this works fine in my tests and on the clients' machine.

Recently, they tried to install the app on a new mac that does not have git installed. The client, who is not tech savvy, is having a lot of trouble installing git and it took me a while to walk them through downloading the installer, clicking on it, running it etc. To avoid this in the future, I'd like to just bundle git in my electron application and use a local copy. Is this possible/doable/desirable? Are there any other good ways to approach this problem?

回答1:

I'd recommend you to build installers instead of your git solution. electron has support for automatic updates (windows/mac) and electron-builder creates installers for you (with autoUpdates enabled). This should be way less painful and more stable.

Then, if you still need to bundle 3rd party stuff w/ your app see How to bundle a third party binary with Electron? and other answers on SO.

If you provided some more details I could give you a tailored answer (OS, private app just for your client?, ...).