gh-auth-isolation

Manage multiple GitHub identities in automated agent workflows using the gh CLI.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The skill helps automate safe, multi-account GitHub operations by avoiding cross-account credential leakage and ensuring the correct identity is used for each action.

Core Features & Use Cases

  • Detect Active Identity using gh auth status to ensure you know which account is active and where tokens come from.
  • Extract a Specific Account's Token with gh auth token --user to perform actions under a different identity without changing the default.
  • Push to Personal Repos from EMU Shell by using an inline token in the remote URL for one-off operations, then revert to EMU context.
  • Create PRs on Personal Forks with gh pr create and environment tokens as needed, enabling cross-account collaboration.
  • Config Directory Isolation (Advanced) with GH_CONFIG_DIR to fully isolate credentials per account.
  • Shell Aliases for quick switching (PowerShell and Bash/Zsh) to switch contexts quickly in scripts.

Quick Start

Verify the active identity with gh auth status, switch to the target account using a dedicated GH_CONFIG_DIR, and perform a test operation such as pushing to a personal repository.

Frequently Asked Questions about gh-auth-isolation

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

FAQPage Schema
How do I manage multiple GitHub accounts in CI without credential leakage?

Managing multiple GitHub accounts in CI requires isolated config directories and runtime token fetching via gh auth token --user to prevent cross-account credential leakage during automated workflows.

Can I push to a personal GitHub repo from an enterprise managed user shell?

You can push to personal repos from an EMU shell by injecting an inline token into the remote URL for a one-off operation, then reverting the remote back to the enterprise context.

What's the best way to create PRs across personal forks with gh CLI?

Creating PRs across personal forks involves extracting the specific account token with gh auth token --user and passing environment tokens to gh pr create, enabling cross-account collaboration without switching defaults.

Does the gh CLI support isolated config directories for identity switching?

The gh CLI supports isolated config directories by setting the GH_CONFIG_DIR environment variable, which fully isolates credentials per account for advanced identity switching scenarios.

Why does my automated agent workflow use the wrong GitHub identity?

Automated workflows use the wrong GitHub identity when default credentials persist across operations; detecting active identity with gh auth status and using isolated config directories resolves this.