gh-auth-isolation

Isolate GitHub identities across EMU and personal accounts using gh config directories.

49|6|Updated Aug 24, 2021
One-click install
npx skills add https://github.com/webmaxru/bpm-counter --skill gh-auth-isolation-webmaxru
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gh-auth-isolation
Source: https://github.com/webmaxru/bpm-counter/tree/main/.copilot/skills/gh-auth-isolation
Command: npx skills add https://github.com/webmaxru/bpm-counter --skill gh-auth-isolation-webmaxru

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

GitHub authentication in agent workflows often defaults to an Enterprise Managed User (EMU) account, causing operations on personal repos or forks to fail. This skill enables safe isolation of multiple GitHub identities to prevent credential leakage and context confusion.

Core Features & Use Cases

  • Detect the active identity with gh auth status and identify current account and token scopes.
  • Extract a specific account's token with gh auth token --user personaluser or --user corpalias_enterprise to perform actions as that user.
  • Push to personal repos from EMU by using a token-authenticated URL for a single operation.
  • Create PRs from personal forks to upstream with gh pr create and carefully chosen repo/head parameters.
  • Config Directory Isolation using separate GH_CONFIG_DIR environments to isolate credentials per account.
  • Shell Aliases for quick switching to personal or EMU accounts (e.g., ghp for personal, ghe for EMU).

Quick Start

Create isolated gh config directories and switch between EMU and personal accounts before running GitHub operations.

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 accounts in automation without leaking credentials?

Prevent credential leakage by isolating GitHub identities using separate GH_CONFIG_DIR environments and extracting account-specific tokens with gh auth token --user, ensuring safe identity switching in automated workflows.

Why do automated pushes to personal repos fail when using an EMU account?

Pushes to personal repos fail with an EMU account because GitHub authentication defaults to the enterprise context, restricting access. Isolating identities and using a token-authenticated URL for the personal user bypasses this EMU limitation.

How do I create a pull request from a personal fork to an upstream enterprise repo?

Create pull requests from personal forks by extracting the personal account token and executing gh pr create with carefully chosen repo and head parameters, ensuring the PR targets the correct upstream repository context.

Can I isolate gh CLI configurations for multiple GitHub accounts?

Yes, you can isolate gh CLI configurations by setting separate GH_CONFIG_DIR environment variables per account, allowing distinct credential storage and preventing context confusion between EMU and personal identities.

What is the best way to manage multiple GitHub tokens in CI pipelines?

Manage multiple GitHub tokens in CI pipelines by isolating configuration directories and extracting specific account tokens on demand using gh auth token --user, preventing credential leakage across automated enterprise and personal operations.