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_

貢獻指南

開啟貢獻指南

研究方向

Reproduce the prompt by starting the CLI in a git-controlled directory and asking it to create a file in an unrelated directory such as C:\temp\copilot. Trace how the safe-directory choice is associated with the edited file, and confirm that the prompt names that file's directory rather than the CLI session's current repository.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
git
領域
cli, security
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。