gh-auth-isolation

Detect and isolate active GitHub identities with gh auth status and GH_CONFIG_DIR.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/chdaly/eshop --skill gh-auth-isolation-chdaly
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gh-auth-isolation
Source: https://github.com/chdaly/eshop/tree/main/.copilot/skills/gh-auth-isolation
Command: npx skills add https://github.com/chdaly/eshop --skill gh-auth-isolation-chdaly

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

GitHub authentication in multi-account environments often mixes Enterprise Managed User (EMU) and personal identities, causing operations to run under the wrong account. This Skill teaches agents how to detect the active identity, switch contexts safely, and avoid credential leakage or unintended cross-account actions.

Core Features & Use Cases

  • Detect current identity with gh auth status to determine the active account.
  • Safely switch context for operations using separate gh configurations (GH_CONFIG_DIR) without changing the global environment.
  • Extract and use per-operation tokens when needed to push, PR, or manage repos from the correct account.
  • Provide quick aliases or scripts to streamline switching between EMU and personal accounts during common tasks.

Quick Start

Ensure the active identity is correct, configure an isolated gh context, and perform the desired GitHub operation.

Frequently Asked Questions about gh-auth-isolation

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

FAQPage Schema
How do I isolate GitHub identities to prevent cross-account actions in workflows?

You can isolate GitHub identities by applying non-persistent context isolation via separate GH_CONFIG_DIR configurations. This approach detects the active identity using gh auth status and prevents credential leakage during multi-account operations.

How does gh auth status work with Enterprise Managed User and personal accounts?

The gh auth status command detects the active GitHub identity, enabling safe switching between EMU enterprise accounts and personal accounts. It ensures operations like pushes and PRs run under the correct account without mixing credentials.

What is the best way to switch GitHub accounts for a single push or pull request?

The best way to switch accounts for a single operation is to extract a per-operation token using gh auth token within an isolated gh context. This allows you to perform pushes or PRs from the correct account without modifying the global environment.

Can I safely manage multiple GitHub accounts in automated agent workflows?

Yes, you can safely manage multiple GitHub accounts in agent workflows by implementing identity detection and per-command resets. This isolates the active identity and prevents unintended cross-account actions during repository management.

Why does my GitHub CLI run operations under the wrong enterprise or personal account?

Operations run under the wrong account when GitHub authentication mixes EMU and personal identities in the global environment. Isolating the active identity with separate GH_CONFIG_DIR configurations prevents this credential leakage.