gh-auth-isolation

Detect and switch GitHub identities to prevent cross-account credential leakage.

9|1|Updated Jul 21, 2025
One-click install
npx skills add https://github.com/usepowershell/PoshMcp --skill gh-auth-isolation-usepowershell
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gh-auth-isolation
Source: https://github.com/usepowershell/PoshMcp/tree/main/.copilot/skills/gh-auth-isolation
Command: npx skills add https://github.com/usepowershell/PoshMcp --skill gh-auth-isolation-usepowershell

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Managing multiple GitHub identities (EMU and personal) in automated agent workflows often leads to credential leakage, accidental actions under the wrong account, and failed operations when repositories or PRs require a specific identity. This skill teaches agents how to detect the active identity, switch contexts safely, and isolate credentials to prevent cross-account access.

Core Features & Use Cases

  • Detect current identity: Verify the active gh account with gh auth status and interpret outputs to determine which account is in use.
  • Safe token extraction: Retrieve a specific account token at runtime using gh auth token --user without persisting credentials.
  • Per-task isolation: Run operations under a chosen identity in isolated environments to prevent cross-account actions.
  • Practical workflows: Push to personal forks or submit PRs from the correct account, while keeping EMU work credentials intact.
  • Security best practices: Avoid leaking credentials by using ephemeral tokens and per-run task configuration.

Quick Start

Switch to the personal GitHub identity before performing actions on personal repositories.

Frequently Asked Questions about gh-auth-isolation

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

FAQPage Schema
How do I switch GitHub identities in automated workflows to prevent credential leakage?

Switching GitHub identities safely requires detecting the active account via gh auth status and extracting specific tokens using gh auth token --user. Per-task runscape isolation and environment-scoped configuration prevent cross-account credential leakage in AI agent workflows.

What is the best way to manage EMU and personal GitHub accounts for separate PRs?

Managing EMU and personal GitHub accounts requires per-task identity isolation to ensure forks, PRs, and private repo access execute under the correct context. Use gh auth status to verify the active identity before pushing to personal forks while keeping enterprise credentials intact.

How do I retrieve a specific GitHub account token at runtime without persisting credentials?

Retrieve a specific GitHub account token at runtime using the gh auth token --user command. This method extracts ephemeral tokens dynamically without persisting credentials, ensuring secure identity switching and preventing cross-account leakage in automated workflows.

Does gh auth status work with AI agents to detect the current GitHub identity?

Yes, gh auth status works with AI agents to detect the current GitHub identity. Agents can interpret the command outputs to determine which account is active, enabling safe identity switching and per-task isolation before performing actions on private repos or submitting PRs.

Why does cross-account credential leakage happen when using multiple GitHub identities?

Cross-account credential leakage happens when automated workflows lack environment-scoped configuration and per-task runscape isolation. Without proper identity detection and token extraction, AI agents may accidentally perform actions under the wrong GitHub account, compromising workflow security.

When should I use environment-scoped configuration for GitHub identity switching?

Use environment-scoped configuration for GitHub identity switching when AI agents orchestrate workflows requiring both EMU corporate accounts and personal accounts. This isolation prevents cross-account access during tasks like pushing to personal forks or accessing private repos.