【发布时间】:2022-08-19 08:29:27
【问题描述】:
我有一个在 macOS Monterey (v12.5) 上运行的电子应用程序 (Electron v17.4.10),在启动时它会尝试执行命令
git lfs install
。它通过使用 Node child_process 包的 spawn 命令来调用对独立 git 可执行文件的直接调用来实现这一点。
安装电子应用程序时,它会提供自己的 git 版本,该版本未添加到 PATH 以防止干扰可能已安装的任何 git 版本。独立版本的 git (v2.33.0) 具有如下图所示的文件夹结构,并且 git-lfs 二进制文件 (v3.2.0) 包含在
/PortableGit/git/libexec/git-core/
中
Standalone Git Directory Structure
执行的完整命令是:
\"/Applications/MyApp/Utilities/PortableGit/bin/git\" lfs install
输出是:
git: \'lfs\' is not a git command. See \'git --help\'.
The most similar command is
log
如何让 git 独立安装以识别子命令
lfs
而无需将其放在 PATH 上?像我描述的那样有一个独立的 git 包是可能的吗?还是我应该放弃这种方法并确保在目标机器上正确安装了 git?