github-multi-account

Configure account-specific gh aliases for multiple GitHub accounts.

Updated Mar 18, 2022
One-click install
npx skills add https://github.com/mpaulosky/dotfiles --skill github-multi-account-mpaulosky
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: github-multi-account
Source: https://github.com/mpaulosky/dotfiles/tree/main/.copilot/skills/github-multi-account
Command: npx skills add https://github.com/mpaulosky/dotfiles --skill github-multi-account-mpaulosky

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill detects when a user has multiple gh-authenticated GitHub accounts and automates installing account-locked aliases so CLI operations never run under the wrong identity.

Core Features & Use Cases

  • Automatic detection and prompting: Runs gh auth status, lists discovered accounts, and asks the user to label personal versus work accounts.
  • Environment configuration: Adds PowerShell profile functions, creates CMD wrapper scripts in a user bin directory, updates the user PATH, and loads aliases into the current session.
  • Verification and guidance: Verifies the setup by querying the GitHub API for each alias and instructs users and agents to use ghp/ghw for personal and work repositories respectively.
  • Use Case: A developer juggling personal and employer accounts can run the skill to install ghp and ghw aliases and avoid accidental pushes or repo operations under the wrong account.

Quick Start

Run the skill to detect your gh accounts, confirm which is personal versus work, and install ghp and ghw aliases into your PowerShell profile and PATH.

Frequently Asked Questions about github-multi-account

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

FAQPage Schema
How do I switch between multiple GitHub accounts using the gh CLI?

To switch GitHub accounts, you can configure account-specific gh aliases. This allows you to use dedicated commands like ghp for personal and ghw for work repositories, preventing accidental pushes under the wrong identity.

How do I set up separate gh aliases for personal and work GitHub accounts on Windows?

Setting up separate gh aliases involves running a configuration that detects authenticated accounts via gh auth status, prompts for role assignments, and writes PowerShell profile functions and CMD wrappers to update your user PATH.

Can I run gh operations under a specific GitHub account without changing my global auth status?

Yes, you can run gh operations under a specific GitHub account by installing account-locked aliases. The setup verifies each alias by querying the GitHub API to ensure CLI operations execute under the correct identity.

What is the best way to manage accidental pushes when juggling personal and employer GitHub accounts?

The best way to manage accidental pushes is to automate installing account-locked aliases. This ensures CLI operations consistently target either personal or work repositories based on the alias you invoke.

Do I need PowerShell to configure gh aliases for multiple GitHub accounts?

You need PowerShell to configure the aliases because the setup adds PowerShell profile functions and creates CMD wrapper scripts. It updates the user PATH and loads the aliases into your current session for immediate use.