大虾居

谈笑有鸿儒,往来无白丁。

0%

在WindowsTerminal中添加GitBash

Git-bash 是windows上常用的可以使用*nux命令行,随git一起安装,可谓居家旅行必备。

Windows Terminal是windows 10上的一款开源的多终端窗口,可以在一个窗口中打开不同终端,对于使用终端频繁的同学来说可以节省在多个窗口中来回跳转的不便。

如果能在Windows Terminal中打开Git Bash岂不是所有命令行都能放在一起了。下面虾哥就教你如何配置在Windows Terminal标签栏中开启Bash

1 打开Windows Terminal
2 按下 Ctrl + , 打开程序配置(程序配置是json格式文本文件,会在文本编辑器中打开)
3 找到 profiles > list, list下面是个列表,在列表中加入选项,注意json格式,列表最后一项后面没有逗号,下面代码里包含了安装在%USERPROFILE%下的配置,可以根据自身情况修改注释信息。

1
2
3
4
5
6
7
8
9
10
11
{
"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%",
},

参考

https://stackoverflow.com/questions/56839307/adding-git-bash-to-the-new-windows-terminal