将Git-Bash添加到新的Windows Terminal [英] Adding Git-Bash to the new Windows Terminal
本文介绍了将Git-Bash添加到新的Windows Terminal的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正试图在新的Windows Terminal中添加一个新的终端(Git Bash),但是我无法使其正常工作.
I'm trying to add a new terminal (Git Bash) to the new Windows Terminal, however I can't get it to work.
我尝试将profiles
数组中的commandline
属性更改为git-bash.exe
,但是没有运气.
I tried changing the commandline
property in the profiles
array to git-bash.exe
but no luck.
有人知道如何使它工作吗?
Does anyone have an idea how to get this to work?
推荐答案
概述
- 使用
ctrl + ,
打开设置
- 您需要将以下配置文件选项之一(取决于您安装的git版本)附加到
settings.json
文件的"list":
部分
- Open settings with
ctrl + ,
- You'll want to append one of the profiles options below (depending on what version of git you have installed) to the
"list":
portion of thesettings.json
file
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{00000000-0000-0000-ba54-000000000001}",
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles
},
"list":
[
<put one of the configuration below right here>
]
}
}
个人资料选项
如果正在使用,请取消注释commandline
和icon
的正确路径:
-
%PROGRAMFILE%
中的Windows Git
-
%USERPROFILE%
中的Windows Git
- 如果您使用的是 scoop
- Git for Windows in
%PROGRAMFILE%
- Git for Windows in
%USERPROFILE%
- If you're using scoop
{
"guid": "{00000000-0000-0000-ba54-000000000002}",
"commandline": "%PROGRAMFILES%/git/usr/bin/bash.exe -i -l",
// "commandline": "%USERPROFILE%/AppData/Local/Programs/Git/bin/bash.exe -l -i",
// "commandline": "%USERPROFILE%/scoop/apps/git/current/usr/bin/bash.exe -l -i",
"icon": "%PROGRAMFILES%/Git/mingw64/share/git/git-for-windows.ico",
// "icon": "%USERPROFILE%/AppData/Local/Programs/Git/mingw64/share/git/git-for-windows.ico",
// "icon": "%USERPROFILE%/apps/git/current/usr/share/git/git-for-windows.ico",
"name" : "Bash",
"startingDirectory" : "%USERPROFILE%",
},
您还可以添加其他选项,例如:
You can also add other options like:
{
"guid": "{00000000-0000-0000-ba54-000000000002}",
// ...
"acrylicOpacity" : 0.75,
"closeOnExit" : true,
"colorScheme" : "Campbell",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 10,
"historySize" : 9001,
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"useAcrylic" : true
}
注释
- 从 https://github.com/microsoft/terminal/pull/2475 这将不再生成.
-
guid
可以在globals
>中使用.defaultProfile
,因此您可以按 Ctrl Shift T 或启动Windows终端,默认情况下它将启动bash - make your own
guid
as of https://github.com/microsoft/terminal/pull/2475 this is no longer generated. - the
guid
can be used in in theglobals
>defaultProfile
so you can press you can press CtrlShiftT or start a Windows terminal and it will start up bash by default
Notes
"defaultProfile" : "{00000000-0000-0000-ba54-000000000001}",
-
-l -i
以确保加载.bash_profile
- 使用环境变量,以便它们可以正确映射到不同的系统.
- 目标
git/bin/bash.exe
避免产生其他进程,根据Process Explorer的统计,与使用bin/bash或git-bash相比,每个进程可节省约10MB -l -i
to make sure that.bash_profile
gets loaded- use environment variables so they can map to different systems correctly.
- target
git/bin/bash.exe
to avoid spawning off additional processes which saves about 10MB per process according to Process Explorer compared to using bin/bash or git-bash
我的配置在 https://gist.github.com/trajano/24f4edccd9a997fad8b4de29ea252cc8
这篇关于将Git-Bash添加到新的Windows Terminal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文