Loading

git for windows 官方提供的 windows terminal 配置文件路径查找

git for windows 安装包已经支持了添加 windows termial 配置,所以使用 windows terminal 的用户终于不用自己手动添加配置了,如下图:
image

但是我一直有一个疑问,那就是 git for windows 安装包把这个默认配置,放到那里去了?

我在windows terminal 的 settings.json 配置文件中,只找到了这样一段 git bash 配置:

{
    "guid": "{2ece5bfe-50ed-5f3a-ab87-5cd4baafed2b}",
    "hidden": false,
    "name": "Git Bash",
    "source": "Git"
},

但在 defaults.json (按住alt点击设置菜单可打开)却没有这个git bash的具体配置参数,那么git安装包把windows terminal的默认配置放到哪儿去了呢?

经过一番查找,我发现 git for windows 项目的 issue 3183 中关联了一个 PR 339 用于处理这个问题的,如下图

image

通过上面的配置的改动,可以看出它在 Windows Terminal 的安装目录添加了配置文件 Fragments\Git\git-bash.json ,这就是 git bash 在 windows terminal 的默认配置所在了。

综上,git for windows 安装包提供的 Windows Terminal - Git Bash 默认配置文件位于: C:\ProgramData\Microsoft\Windows Terminal\Fragments\Git\git-bash.json

格式化后内容如下:

{
    "profiles": [
        {
            "guid": "{2ece5bfe-50ed-5f3a-ab87-5cd4baafed2b}",
            "name": "Git Bash",
            "commandline": "C:/Program Files/Git/bin/bash.exe -i -l",
            "icon": "C:/Program Files/Git/mingw64/share/git/git-for-windows.ico",
            "startingDirectory": "%USERPROFILE%"
        }
    ]
}
posted @ 2022-06-02 11:00  wswind  阅读(372)  评论(0编辑  收藏  举报