gh-auth-isolation

Detect active GitHub identity and extract per-user tokens for isolated operations.

2|Updated Apr 21, 2026
One-click install
npx skills add https://github.com/elbruno/md-to-slides --skill gh-auth-isolation-elbruno
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gh-auth-isolation
Source: https://github.com/elbruno/md-to-slides/tree/main/.copilot/skills/gh-auth-isolation
Command: npx skills add https://github.com/elbruno/md-to-slides --skill gh-auth-isolation-elbruno

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents GitHub operations from failing or corrupting results when an agent uses the wrong gh authentication context (e.g., Enterprise Managed User vs personal GitHub) during multi-account workflows.

Core Features & Use Cases

  • Detect the active GitHub identity before performing any authenticated operation, so the agent can avoid using the wrong account context.
  • Extract the correct account token on demand using gh auth token --user without switching the global authenticated default.
  • Safely perform targeted actions like pushing to personal repos or creating PRs on personal forks while minimizing the risk of credential leakage or cross-account mixing.

Quick Start

Ask the agent to identify the active gh login with gh auth status, extract the token for the required user with gh auth token --user <username>, and use that token only for the specific push or PR command that needs the personal identity.

Frequently Asked Questions about gh-auth-isolation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent GitHub push failures from using the wrong account token?

Prevent GitHub push failures by detecting the active login with `gh auth status` and extracting the correct token using `gh auth token --user` for the specific operation. This isolates identities without changing the global default, avoiding cross-account credential mixing.

What causes GitHub CLI to use the wrong authentication context in multi-account workflows?

GitHub CLI uses the wrong authentication context when the shell default points to an unintended identity, such as an Enterprise Managed User instead of a personal account. Token mix-ups happen when agents execute authenticated commands without isolating the correct user identity.

How do I create a PR from a personal fork without switching my default GitHub login?

Create a PR from a personal fork by extracting the required identity token with `gh auth token --user <username>` and applying it only to that specific PR creation command. This performs targeted actions without persisting credentials or altering the global authenticated default.

Does gh auth token work with Enterprise Managed User and personal GitHub accounts simultaneously?

Yes, `gh auth token` works with Enterprise Managed User and personal GitHub accounts simultaneously by isolating identities on demand. You can optionally use `GH_CONFIG_DIR` to execute single-operation authenticated commands for either account without persisting credential switches.

What are the limitations of isolating GitHub tokens for agent-driven tasks?

Limitations of isolating GitHub tokens include the need to explicitly detect the active identity before every authenticated operation and the requirement to pass tokens per-command. It does not persist credential changes, meaning each agent-driven push or PR needs individual token extraction.