windows - 将 gitbash 添加到 windows cmd 以运行 make 文件
问题描述
我有一台安装git
在上面的 Windows 机器。在安装时我检查了add the gitbash to environment
但安装后当我ls
在我的 Windows cmd 中运行一个 smiple 命令时我得到了错误
'ls' is not recognized as an internal or external command,
operable program or batch file.
现在这是我窗户上的环境变量
第二个是 git 在安装时自动添加的,但我通过搜索堆栈溢出来添加第一个,但它们似乎都不起作用。
额外细节:
万一你想知道它给我带来了什么麻烦。我正在运行一些可以在我的设备上make
正常运行的命令,gitbash
但在我的 goland 终端上却出现了这个错误
./scripts/fmt.sh provider
process_begin: CreateProcess(NULL, sh C:\Users\farsh\go\src\gojeh\scripts\fmt.sh provider, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:16: run] Error 2
解决方案
TL;博士
适用于 Windows 的 Git 故意只在您的 Windows PATH 上设置最低限度
细节
如果您查看git\bin
目录,您会看到只有git
,bash
并且sh
在那里。然后有一个git\usr\bin
目录将是您期望的标准 *nix 风格的实用程序,包括ls
,虽然不包括make
在我的机器上。这些不会添加到您的 Windows 路径中,因为它们中的许多会与标准的 Windows 实用程序冲突,并且隐藏它们可能会对 Windows 中运行的其他东西产生不可预测的影响。
所以你会发现额外的东西只有在你在 Git Bash 内部运行时才可见,它们应该以 *nix 方式工作。
如果您make
的系统需要,您可能应该安装一个打算在 Windows 上使用的版本。
推荐阅读
- javascript - 为什么全局数组声明会使测试失败?
- c++ - 使用 ffmpeg 链接开发失败
- string - 如何用逗号分割用户输入的字符串
- android - Android Studio:MotionEvent - 触摸跟踪
- python - 在熊猫的帮助下设置开始列以将数据写入excel
- azure - 我可以设置一个管道阶段以等待一个阶段在单独的管道上完成吗?
- radio-button - 如何在数据集字段中存储 wix 中单选按钮的值?
- c# - 实体框架自定义身份用户模型
- amazon-web-services - 调用调用 API 操作失败并显示以下消息:为函数定义的角色无法由 Lambda 承担
- reactjs - 为什么 TypeScript 不处理存储在变量中的布尔值?