Skip to content

[Feature]: Support GitHub Copilot on GitHub Enterprise Server (GHE) #11442

@lmmzss-jk

Description

@lmmzss-jk

Problem or Use Case

Summary

The current Copilot provider only works with github.com. It does not support GitHub Enterprise Server (GHE) instances where the Copilot token endpoint and proxy
are hosted on a custom domain.

Current Behavior

When selecting "GitHub Copilot" via hermes model, the OAuth device code flow always redirects to https://github.com/login/device. The Copilot token endpoint is
hardcoded to https://api.github.com/copilot_internal/v2/token.

For GHE Server users, this results in:

  • OAuth login pointing to the wrong host
  • Token exchange returning 401 Bad credentials (because the GHE token is not valid on api.github.com)

Proposed Solution

Add a config option copilot.github_host (default: github.com).

Example config (~/.hermes/config.yaml):

 copilot:
   github_host: "ghe.example.com"

Or via env var: COPILOT_GITHUB_HOST=ghe.example.com

Changes needed:

  1. Auto-detect from ~/.config/github-copilot/apps.json — if a GHE host entry exists, offer it during hermes model setup
  2. OAuth device flow should target https://{github_host}/login/device instead of hardcoded https://github.com/login/device
  3. Token endpoint should use https://{github_host}/api/v3/copilot_internal/v2/token instead of https://api.github.com/copilot_internal/v2/token
  4. Use the endpoints object from the token response dynamically (it returns endpoints.proxy, endpoints.api) instead of hardcoding github.com URLs

Alternatives Considered

Tried using "Enter a token manually" with the GHE OAuth token, but Hermes still calls api.github.com for token exchange,
which rejects the GHE token with 401.

Feature Type

Configuration option

Scope

Small (single file, < 50 lines)

Contribution

  • I'd like to implement this myself and submit a PR

Debug Report (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions