我已安装适用于 Windows 的 Git,并选中了“覆盖本机命令”选项。我已检查我的 PATH:
C:\Users\Domenic>echo %PATH%
C:\Program Files\Git\usr\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Windows\system32;C:\Windows;C:\python2;C:\python2\Scripts;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\GitExtensions\;C:\Program Files\LLVM\bin;C:\depot_tools;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Ruby21-x64\bin;C:\ProgramData\nodist\bin;C:\ruby200\bin;C:\Chocolatey\bin;C:\Program Files\kdiff3;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Docker Toolbox;C:\Users\Domenic\AppData\Roaming\npm;C:\Users\Domenic\Dropbox\PATH
(如果您不想滚动那么多,只需注意这C:\Program Files\Git\usr\bin
是第一个)
我已经检查过where
:
C:\Users\Domenic>where mkdir
C:\Program Files\Git\usr\bin\mkdir.exe
当我直接运行它时,它运行良好:
C:\Users\Domenic>"C:\Program Files\Git\usr\bin\mkdir.exe" --help
Usage: /usr/bin/mkdir [OPTION]... DIRECTORY...
Create the DIRECTORY(ies), if they do not already exist.
Mandatory arguments to long options are mandatory for short options too.
-m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
(... etc ...)
但是,当我尝试mkdir
从命令行运行时,它总是返回到 Windows 的内置命令行:
C:\Users\Domenic>mkdir --help
A subdirectory or file --help already exists.
C:\Users\Domenic>mkdir /?
Creates a directory.
MKDIR [drive:]path
(... etc ...)
为什么我不能覆盖 mkdir?
Windows 10,适用于 Windows 的 Git 2.7.3