github / github/copilot-cli

Permission prompt incorrectly associates non-git directory with CLI session's git repo when adding safe directory

未关闭
#3,616 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area:permissions
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

### Describe the bug

Bug: When editing a file in a directory that is not under git (e.g., C:\temp\copilot), the permission prompt "Yes, and don't ask again for file operations in this repo" incorrectly references the CLI session's current git repository (C:\git\jdev\src) instead of the file's actual directory. The safe-directory association should be based on the file being edited, not the CLI's CWD.

Image

### Affected version

You're running **GitHub Copilot CLI 1.0.56**. Worth including in your bug report!

### Steps to reproduce the behavior

start copilot in a directory that is under git control. tell copilot to create a file in a directory that is not under git control. it will ask if it can edit the file and then ask if it should put the git-controlled directory in the directories list

### Expected behavior

I would expect it to ask if it can put the directory where I've asked it to edit the file in its safe directories list.

### Additional context

_No response_

贡献指南

打开贡献指南

调研方向

通过在 git 控制的目录中启动 CLI,并要求它在类似 C:\temp\copilot 的无关目录中创建文件,来复现 prompt。跟踪 safe-directory 选择如何与被编辑的文件关联,并确认 prompt 指出的是该文件所在的目录,而不是 CLI 会话当前的 repository。

由索引模型根据 Issue 内容生成。

评估

技术栈
git
领域
cli, security
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。