Launching VS Code from Copilot CLI drops empty GIT_CONFIG_VALUE and breaks Git discovery
还没有人认领这个 Issue。
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
Describe the bug
Copilot CLI exports an indexed GIT_CONFIG_COUNT / GIT_CONFIG_KEY_* / GIT_CONFIG_VALUE_* block into shell-command child processes. The core.fsmonitor override is represented by an empty value.
When VS Code is launched from the Copilot CLI environment with code ., VS Code's Git extension retains GIT_CONFIG_COUNT=4 and GIT_CONFIG_KEY_3=core.fsmonitor, but GIT_CONFIG_VALUE_3 is absent. Every Git command then fails before repository discovery:
error: missing config value GIT_CONFIG_VALUE_3
fatal: unable to parse command-line config
The Source Control pane consequently does not recognize the directory as a Git repository.
Affected version
GitHub Copilot CLI 1.0.81-3
Steps to reproduce the behavior
-
Start Copilot CLI on Windows in a Git repository.
-
Launch VS Code from the CLI environment:
code . -
Open the Source Control pane or inspect the VS Code Git log.
-
Observe repository discovery failing, for example:
> git rev-parse --show-toplevel error: missing config value GIT_CONFIG_VALUE_3 fatal: unable to parse command-line config
The relevant environment inherited from Copilot CLI is:
GIT_CONFIG_COUNT=4
GIT_CONFIG_KEY_0=safe.bareRepository
GIT_CONFIG_VALUE_0=explicit
GIT_CONFIG_KEY_1=safe.bareRepository
GIT_CONFIG_VALUE_1=explicit
GIT_CONFIG_KEY_2=credential.interactive
GIT_CONFIG_VALUE_2=never
GIT_CONFIG_KEY_3=core.fsmonitor
GIT_CONFIG_VALUE_3=<empty>
Git works directly in the Copilot shell because the empty variable is still present and resolves as core.fsmonitor=false. Clearing the injected block before launching VS Code avoids the failure:
Get-ChildItem Env:GIT_CONFIG_* | Remove-Item
code --new-window .
Expected behavior
Programs launched from Copilot CLI should be able to run Git normally. Internal Git hardening overrides should either be scoped to Copilot's own Git subprocesses, use a non-empty value such as core.fsmonitor=false, or otherwise remain a complete valid indexed block in child applications.
Additional context
- OS: Windows NT 10.0.26200.0, x64
- PowerShell: 7.6.5
- VS Code: 1.134.0, x64
- Git: 2.55.0.windows.3
- Copilot CLI's
safe.bareRepository=explicithardening is intentional; the failure is specifically the process-wide propagation of an empty indexed value into a GUI child process.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
报告中没有指定任何仓库文件或测试。首先重现 Windows 下 code . 的启动,并跟踪 Copilot CLI 在哪里构建和导出已索引的 GIT_CONFIG_* 环境;将其与直接执行 Git 进行比较。完成的标准是:子应用程序收到一个完整有效的 block,或不收到任何进程范围的 block,并且 git rev-parse --show-toplevel 在 VS Code 中成功执行。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- git, shell, vscode
- 领域
- cli, devtools
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 58/100