Skip to content

Add GitHub Enterprise support to the gh plugin#609

Closed
scottisloud wants to merge 1 commit into
1Password:mainfrom
scottisloud:feature/github-enterprise-support
Closed

Add GitHub Enterprise support to the gh plugin#609
scottisloud wants to merge 1 commit into
1Password:mainfrom
scottisloud:feature/github-enterprise-support

Conversation

@scottisloud

Copy link
Copy Markdown
Contributor

Overview

The GitHub shell plugin previously always provisioned GITHUB_TOKEN, which does not work for GitHub Enterprise Server hosts. This change adds a host-aware provisioner that sets the environment variables gh expects based on the credential's Host field:

  • github.com (default): GH_TOKEN, GITHUB_TOKEN
  • GitHub Enterprise Cloud (*.ghe.com): GH_TOKEN, GITHUB_TOKEN, GH_HOST
  • GitHub Enterprise Server (other hosts): GH_ENTERPRISE_TOKEN, GITHUB_ENTERPRISE_TOKEN, GH_HOST

When separate 1Password items are configured for github.com and Enterprise Server, both sets of variables are provisioned so gh can authenticate to either host.

Type of change

  • Created a new plugin
  • Improved an existing plugin
  • Fixed a bug in an existing plugin
  • Improved contributor utilities or experience

Related Issue(s)

How To Test

  1. Run the GitHub plugin tests:

    go test ./plugins/github/...
  2. Configure a 1Password item with a personal access token and Host set to a GitHub Enterprise Server hostname (for example enterprise.github.com), then enable the GitHub shell plugin for gh.

  3. Run gh auth status or gh repo list and confirm the process receives GH_ENTERPRISE_TOKEN, GITHUB_ENTERPRISE_TOKEN, and GH_HOST instead of only GH_TOKEN / GITHUB_TOKEN.

  4. Optionally configure a second item for github.com (with Host empty) alongside the Enterprise item and confirm both token variables are available when running gh.

Changelog

The GitHub plugin now provisions GH_ENTERPRISE_TOKEN for GitHub Enterprise Server hosts and supports authenticating to both github.com and Enterprise when separate credentials are configured.

Made with Cursor

Use GH_ENTERPRISE_TOKEN for Enterprise Server hosts and GH_TOKEN for
github.com and Enterprise Cloud, so users can authenticate to both when
they have separate credentials configured.

Fixes 1Password#137

Co-authored-by: Cursor <cursoragent@cursor.com>
@scottisloud

Copy link
Copy Markdown
Contributor Author

Closing in favor of opening a PR directly from upstream.

@scottisloud scottisloud closed this Jun 4, 2026
@scottisloud scottisloud deleted the feature/github-enterprise-support branch June 4, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for GitHub enterprise

1 participant