我试图添加一个新的终端(Git Bash)到新的Windows终端。然而,我不能让它工作。
我尝试将profiles数组中的命令行属性更改为git-bash.exe,但没有运气。
有人知道怎么让它工作吗?
我试图添加一个新的终端(Git Bash)到新的Windows终端。然而,我不能让它工作。
我尝试将profiles数组中的命令行属性更改为git-bash.exe,但没有运气。
有人知道怎么让它工作吗?
当前回答
我是这样做的:
添加“%programfiles%\Git\Bin”到你的路径 在档案上。将需要的命令行设置为"commandline": "sh——cd-to-home" 重新启动Windows终端
这对我很管用。
其他回答
因为大多数答案要么显示大量不相关的配置,要么不显示配置,所以我创建了自己的答案,试图更集中。它主要是基于配置文件设置参考和阿基米德特拉哈诺的答案。
步骤
Open PowerShell and enter [guid]::NewGuid() to generate a new GUID. We will use it at step 3. > [guid]::NewGuid() Guid ---- a3da8d92-2f3f-4e36-9714-98876b6cb480 Open the settings of Windows Terminal. (CTRL+,) Add the following JSON object to profiles.list. Replace guid with the one you generated at step 1. { "guid": "{a3da8d92-2f3f-4e36-9714-98876b6cb480}", "name": "Git Bash", "commandline": "\"%PROGRAMFILES%\\Git\\usr\\bin\\bash.exe\" -i -l", "icon": "%PROGRAMFILES%\\Git\\mingw64\\share\\git\\git-for-windows.ico", "startingDirectory" : "%USERPROFILE%" },
笔记
There is currently an issue that you cannot use your arrow keys (and some other keys). It seems to work with the latest preview version, though. (issue #6859) Specifying "startingDirectory" : "%USERPROFILE%" shouldn't be necessary according to the reference. However, if I don't specify it, the starting directory was different depending on how I started the terminal initially. Settings that shall apply to all terminals can be specified in profiles.defaults. I recommend to set "antialiasingMode": "cleartype" in profiles.defaults. You have to remove "useAcrylic" (if you have added it as suggested by some other answers) to make it work. It improves the quality of text rendering. However, you cannot have transparent background without useAcrylic. See issue #1298. If you have problems with the cursor, you can try another shape like "cursorShape": "filledBox". See cursor settings for more information.
如果你想显示一个图标,并使用黑色主题。这意味着上面提供的图标看起来不太好。然后你可以在这里找到这个图标
C:\Program Files\Git\mingw64\share\git\ git-for-windows我复制到。
%LOCALAPPDATA%\packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState
并将其命名为git-bash_32px。
用CTRL + SHIFT +滚动控制不透明度。
{
"acrylicOpacity" : 0.75,
"closeOnExit" : true,
"colorScheme" : "Campbell",
"commandline" : "\"%PROGRAMFILES%\\git\\usr\\bin\\bash.exe\" -i -l",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 10,
"guid" : "{73225108-7633-47ae-80c1-5d00111ef646}",
"historySize" : 9001,
"icon" : "ms-appdata:///roaming/git-bash_32px.ico",
"name" : "Bash",
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : true
},
新版本的windows终端可以通过其GUI进行配置。
Setting -> Add new
Under "command line" add the path -> path/to/Git/bin/bash.exe
另一个需要注意的项目-在settings.json中 我发现如果你不使用 "commandline": "C:/Program Files/Git/bin/bash.exe"
取而代之的是: "commandline": "C:/Program Files/Git/ Git -bash.exe"
Git shell将在Windows终端之外的一个独立窗口中打开,而不是在一个选项卡中打开——这不是理想的行为。 此外,Windows终端中打开的选项卡也需要手动关闭,因为它将显示退出的进程信息-[退出的进程的代码为3221225786]等。
可能会让人头疼
我是这样做的:
添加“%programfiles%\Git\Bin”到你的路径 在档案上。将需要的命令行设置为"commandline": "sh——cd-to-home" 重新启动Windows终端
这对我很管用。