Skip to content

Conversation

@rmuir
Copy link

@rmuir rmuir commented Sep 5, 2025

Update Copilot HTTP requests and token lookup to respect the GH_HOST env var, allowing use with GitHub Enterprise instances.

Some networks block the github.com endpoints, so they won't work at all. Provide a way for the user to hit different endpoint other than github.com (e.g. mycorp.ghe.com) without patching the source code.

The GH_HOST environment variable is the same one used to override this for gh cli: https://cli.github.com/manual/gh_help_environment

Note: maybe this isn't the best solution, I'm not a lua guy... but I tested it in such a restrictive environment and it works.

Update Copilot HTTP requests and token lookup to respect the `GH_HOST` env var, allowing use with
GitHub Enterprise instances.

Some networks block the `github.com` endpoints, so they won't work at all. Provide a way for the
user to hit different endpoint other than `github.com` (e.g. mycorp.ghe.com) without patching the
source code.

The `GH_HOST` environment variable is the same one used to override this for `gh` cli:
https://cli.github.com/manual/gh_help_environment
@olimorris olimorris added the P4 Negligible impact and urgency label Sep 5, 2025
@rmuir
Copy link
Author

rmuir commented Sep 5, 2025

Maybe a cleaner solution would be to parse out of the oauth rather than looking for github.com, I don't know. ~/.config/github-copilot/apps.json entry looks like this, the mycorp.ghe.com is in there. Could be a better solution than environment variables and "just work" in more cases:

{"mycorp.ghe.com:Xy1.00deadbeef0":{"user":"my-user","oauth_token":"<nope>","githubAppId":"Xy1.00deadbeef0"}}

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2025

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the Stale label Oct 6, 2025
@AmadeusK525
Copy link

@olimorris Any chance this could be merged? My company just updated copilot support to use Enterprise, so I can't use CodeCompanion anymore without this PR

@AmadeusK525
Copy link

Well, I don't think this patch is enough... testing it locally I can see that the way the plugin handles URLs is too coupled, as the URL is always fully formed with host + path. The "real" fix would be to separate this

@github-actions github-actions bot removed the Stale label Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P4 Negligible impact and urgency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants