我试图添加一个新的终端(Git Bash)到新的Windows终端。然而,我不能让它工作。
我尝试将profiles数组中的命令行属性更改为git-bash.exe,但没有运气。
有人知道怎么让它工作吗?
我试图添加一个新的终端(Git Bash)到新的Windows终端。然而,我不能让它工作。
我尝试将profiles数组中的命令行属性更改为git-bash.exe,但没有运气。
有人知道怎么让它工作吗?
当前回答
搞Linux的,抱歉我来晚了;我只是第一次安装git-bash,并研究它的命令应该在Windows终端中。
据我所知
Cygwin is not Windows, but it provides a POSIX translation layer (cygwin*.dll) so that all those non-Windows executables can run. Even when a new computer program is compiled and built with cygwin, it still turns out a non-Windows executable and it still needs cygwin*.dll to run. MSYS2 is mostly Windows with only a few tools that are probably difficult to port remaining non-Windows and requiring a POSIX translation layer to run (msys*.dll); but, most programs are actually Windows native executables. Even when a new computer program is compiled and built, it is my understanding that turns out a Windows native *.exe.
但我仍然不知道这些MSYSTEM*和MINGW*环境变量是否设置有多重要,当我要使用MINGW编译器时,无论如何。
我确实注意到,在整个线程中,两个命令行都不断出现,即./bin/bash和./usr/bin/bash;所以,我把它们发射出去,比较它们的环境……结果可能会大不相同。
要知道,在启动下面的任何shell之前,我已经有C:\Git\mingw64\bin和C:\Git\usr\bin作为系统变量PATH的一部分;我这样做是因为我希望能够直接从CMD使用bash命令。但我不认为这对下面的结果有任何影响。
c:\Git\bin\bash.exe --login c:\Git\usr\bin\bash.exe --login
Environment Variable c:\Git\bin\bash.exe c:\Git\usr\bin\bash.exe
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EXEPATH c:\git\bin c:\git\bin n n
HOSTNAME n MDXXXXXX n MDXXXXXX
MINGW_CHOST n x86_64-w64-mingw32 n n
MINGW_PACKAGE_PREFIX n mingw-w64-x86_64 n n
MINGW_PREFIX n /mingw64 n n
MSYSTEM_CARCH n x86_64 n x86_64
MSYSTEM_CHOST n x86_64-w64-mingw32 n x86_64-pc-msys
MSYSTEM_PREFIX n /mingw64 n /usr
MSYSTEM MINGW64 MINGW64 n MSYS
PLINK_PROTOCOL ssh ssh n n
SHELL n /usr/bin/bash n /usr/bin/bash
TMPDIR n /tmp n /tmp
ORIGINAL_PATH n y n y
ORIGINAL_TEMP n y n y
ORIGINAL_TMP n y n y
PATH /mingw64/bin:/usr/bin:$HOME/bin:$PATH
PATH $HOME/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:$HOME/bin:$PATH
PATh $PATH
PATH $HOME/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:$PATH
因此,在我看来,更正确的做法是使用。/bin/bash——login;但此时此刻,我不确定会有什么不同,比如说,当真正使用MINGW64/GCC编译一个全新的程序时;让我们拭目以待。
其他回答
将profiles参数更改为"commandline": "%PROGRAMFILES%\\Git\\bin\\bash.exe -l -i"
这对我来说是可行的,并且允许运行.bash_profile别名自动完成脚本。
我是这样做的:
添加“%programfiles%\Git\Bin”到你的路径 在档案上。将需要的命令行设置为"commandline": "sh——cd-to-home" 重新启动Windows终端
这对我很管用。
搞Linux的,抱歉我来晚了;我只是第一次安装git-bash,并研究它的命令应该在Windows终端中。
据我所知
Cygwin is not Windows, but it provides a POSIX translation layer (cygwin*.dll) so that all those non-Windows executables can run. Even when a new computer program is compiled and built with cygwin, it still turns out a non-Windows executable and it still needs cygwin*.dll to run. MSYS2 is mostly Windows with only a few tools that are probably difficult to port remaining non-Windows and requiring a POSIX translation layer to run (msys*.dll); but, most programs are actually Windows native executables. Even when a new computer program is compiled and built, it is my understanding that turns out a Windows native *.exe.
但我仍然不知道这些MSYSTEM*和MINGW*环境变量是否设置有多重要,当我要使用MINGW编译器时,无论如何。
我确实注意到,在整个线程中,两个命令行都不断出现,即./bin/bash和./usr/bin/bash;所以,我把它们发射出去,比较它们的环境……结果可能会大不相同。
要知道,在启动下面的任何shell之前,我已经有C:\Git\mingw64\bin和C:\Git\usr\bin作为系统变量PATH的一部分;我这样做是因为我希望能够直接从CMD使用bash命令。但我不认为这对下面的结果有任何影响。
c:\Git\bin\bash.exe --login c:\Git\usr\bin\bash.exe --login
Environment Variable c:\Git\bin\bash.exe c:\Git\usr\bin\bash.exe
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EXEPATH c:\git\bin c:\git\bin n n
HOSTNAME n MDXXXXXX n MDXXXXXX
MINGW_CHOST n x86_64-w64-mingw32 n n
MINGW_PACKAGE_PREFIX n mingw-w64-x86_64 n n
MINGW_PREFIX n /mingw64 n n
MSYSTEM_CARCH n x86_64 n x86_64
MSYSTEM_CHOST n x86_64-w64-mingw32 n x86_64-pc-msys
MSYSTEM_PREFIX n /mingw64 n /usr
MSYSTEM MINGW64 MINGW64 n MSYS
PLINK_PROTOCOL ssh ssh n n
SHELL n /usr/bin/bash n /usr/bin/bash
TMPDIR n /tmp n /tmp
ORIGINAL_PATH n y n y
ORIGINAL_TEMP n y n y
ORIGINAL_TMP n y n y
PATH /mingw64/bin:/usr/bin:$HOME/bin:$PATH
PATH $HOME/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:$HOME/bin:$PATH
PATh $PATH
PATH $HOME/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:$PATH
因此,在我看来,更正确的做法是使用。/bin/bash——login;但此时此刻,我不确定会有什么不同,比如说,当真正使用MINGW64/GCC编译一个全新的程序时;让我们拭目以待。
添加“%PROGRAMFILES%\\Git\\bin\\bash.exe -l -i”对我不起作用。由于%PROGRAMFILES中的空格符号(在cmd中为分隔符),%终端执行命令“C:\Program”而不是“C:\Program Files\Git\bin\bash.exe -l -i”。解决方案应该是在json文件中添加引号,但我不知道如何。 唯一的解决方案是将“C:\Program Files\Git\bin”添加到%PATH%,并在profiles.json中写入“commandline”:“bash.exe”
新版本的windows终端可以通过其GUI进行配置。
Setting -> Add new
Under "command line" add the path -> path/to/Git/bin/bash.exe