github / github/copilot-cli

Copilot CLI should allow setting a "Default User"

未關閉
#1,673 1 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視
area:enterprise
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### Describe the bug

So I have a GITHUB_TOKEN containing a PAT for my personal github account used by other tooling to access the public github API (i.e. fetching releases in mise, etc.)

But my copilot CLI is logged in to GitHub Enterprise .ghe.com

What I've found is that the copilot CLI will always prefer to use the PAT from GITHUB_TOKEN instead of the oauth credential it should have for GitHub enterprise. This results in it just failing to work outright because my personal token does not have copilot permission, or a copilot subscription.

### Affected version

GitHub Copilot CLI 0.0.417

### Steps to reproduce the behavior

1. Have a GITHUB_TOKEN environment variable containing a PAT with minimal permissions (i.e. only public repo access)
2. Log in to copilot CLI using /login using a GHE account.
3. Close and restart copilot CLI
4. Attempt to use /model and see it complaining that the token doesn't have permissions.
5. Do /user switch to another "user" that actually has permissions
6. Now it actually works.

### Expected behavior

I would expect it to prefer the credential that actually works.

Or allow me to explicitly set a default user here.

### Additional context

_No response_

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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