当我尝试将我的 React 应用程序部署到 github 页面时,我运行了npm run deploy. 它设法构建但在部署时出现以下错误:
git-upload-pack '.': git-upload-pack: command not found
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
我的git remote -v回报:
origin  https://github.com/helplah/shopping-cart.git (fetch)
origin  https://github.com/helplah/shopping-cart.git (push)
我设法通过在此处查看其他答案来解决它。首先,您键入which git-upload-pack以查看 git 是否可以访问它。
如果没有,在 Windows 7 上,您必须转到控制面板 -> 系统 -> 高级系统设置 -> 环境变量 -> 编辑路径。在那里添加 git-upload-pack 的路径。
git-upload-pack 通常在C:\Program Files\Git\mingw64\bin或 中C:\Program Files\Git\mingw64\libexec\git-core。你可以在\Git\mingw64.
我添加了两条路径,重新启动计算机后,它对我有用。