You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 30, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 30, 2025. It is now read-only.
[FEAT]: Allow personal access tokens to be used with gh-copilot #116
Thanks for taking the time to fill out this out! 🙇
By submitting this issue, you agree to follow our Code of Conduct.
Describe the need
Users like @gr2m, @yermulnik and @dark-light-cz have run into problems using gh-copilot in #1 and #98 due to the use of personal access tokens. This is because gh-copilot has only supported the use of GitHub CLI OAuth app due to requirements of the Copilot platform.
This issue is track interest in extending support to personal access tokens.
Version
This affects all github/gh-copilot versions prior to v1.0.6 at the time of creating this issue.
Relevant terminal output
$ export GH_TOKEN="ghp_..."
$ gh copilot suggest
✗ Error: No valid GitHub CLI OAuth token detected
To get started with GitHub Copilot in the CLI, please run: gh auth login --web -h github.com to authenticate via web browser.
The good news is gh-copilot has used cli/go-gh since its inception! ✊ The bad news is that PAT restriction is a larger Copilot authentication challenge beyond gh-copilot. That said, let me see about following up internally to see if there's any movement there.
I have run into the very same issue and would even consider the current behaviour as bug for two reasons
The error message does not tell you that the copilot plugin is using the PAT from the environment but cannot authenticate with it (-> better error message)
The plugin should simply ignore the PAT if it cannot use it for authentication (at most issue a warning).
However, in the end, I'd be happy with both solutions, i.e., if either authentication via PAT would be possible, or if the PAT would be ignored by the plugin (falling back to the next level of authentication).
@andyfeller You asked in some other thread why people use a PAT in environment variables for gh. I just wanted to note that we add PAT to shell environment variable GH_TOKEN, because of a Neovim plugin that uses gh under the hood. Saves us having to authenticate with a browser, each time nvim is opened.
Is there any way to keep that variable intact in the environment, and still access gh copilot? Perhaps setting another environment variable that takes precedence?
Activity
yermulnik commentedon Feb 13, 2025
Just to bump this issue as of https://github.blog/changelog/2025-02-12-github-copilot-chat-and-github-copilot-extension-now-available-for-free-on-github-mobile-and-github-cli/ announcement: ain't
gh-copilotshould be capable of utilizing https://github.com/cli/go-gh (a collection of Go modules to make authoring GitHub CLI extensions easier) for auth to bring smoother experience to users? 🤔@andyfeller By any chance is this issue on a development roadmap please? 🙏🏻
andyfeller commentedon Feb 14, 2025
Thanks for the bump, @yermulnik ❤
The good news is
gh-copilothas usedcli/go-ghsince its inception! ✊ The bad news is that PAT restriction is a larger Copilot authentication challenge beyondgh-copilot. That said, let me see about following up internally to see if there's any movement there.cc @RyanHecht
yermulnik commentedon Feb 14, 2025
Ah, I see. Apologies my newbie mix up of the things =)
And thanks for keeping this request rolling 👍🏻
ascheman commentedon Mar 14, 2025
I have run into the very same issue and would even consider the current behaviour as bug for two reasons
However, in the end, I'd be happy with both solutions, i.e., if either authentication via PAT would be possible, or if the PAT would be ignored by the plugin (falling back to the next level of authentication).
magnusriga commentedon Apr 23, 2025
@andyfeller You asked in some other thread why people use a PAT in environment variables for
gh. I just wanted to note that we add PAT to shell environment variableGH_TOKEN, because of a Neovim plugin that usesghunder the hood. Saves us having to authenticate with a browser, each timenvimis opened.Is there any way to keep that variable intact in the environment, and still access
gh copilot? Perhaps setting another environment variable that takes precedence?Thanks for the help.
jmarcon commentedon May 7, 2025
What I did to solve my problema in my use case was:
I don't know if it is possible to use GITHUB_TOKEN with neovim's plugins.