Logo vun Github Multi Account

Github Multi Account

Communautéit
tamirdresher
github-multi-account

Transparent gh proxy that auto-routes commands to the correct GitHub account based on repo context. Uses GH_CONFIG_DIR isolation — no more account-switching chaos.

Iwwersiicht

Editeurtamirdresher
Repositorysquad-skills
Skill-Nummgithub-multi-account
Stären
44
Forks
9
Matgeliwwert Fichieren
4
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 4 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum tamirdresher op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Github Multi Account an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/tamirdresher/squad-skills/tree/main/plugins/github-multi-account
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/tamirdresher/squad-skills.git /tmp/squad-skills
mkdir -p .claude/skills
cp -r /tmp/squad-skills/plugins/github-multi-account .claude/skills/github-multi-account
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Github Multi Account an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Github Multi Account automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Github Multi Account net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

GitHub Multi-Account Proxy

Confidence: medium — proxy architecture is proven in production via ghe/ghp wrappers; the transparent layer is new.

Problem

When you have two GitHub accounts (EMU work + personal), every gh command risks running against the wrong identity. The original approach used gh auth switch aliases (ghp/ghw), but three friction points remained:

  1. Cognitive load — users must remember ghe vs ghp for every command
  2. Token expiry — expired tokens in ~/.config/gh-emu or ~/.config/gh-public silently break automation (including Ralph)
  3. Git credential gap — git push/pull uses the global credential helper, ignoring GH_CONFIG_DIR isolation

Solution

A transparent gh PowerShell function that intercepts every gh call, detects which account to use from the git remote URL, sets GH_CONFIG_DIR, and delegates to the real gh.exe. Combined with a token health monitor and git credential helper integration.

Key insight: The existing GH_CONFIG_DIR isolation architecture is 90% there — the proxy just makes it transparent. No new dependencies, zero changes to Ralph.

How It Works (with the proxy)

User/script types: gh pr list
    │
    ├─ Is GH_CONFIG_DIR already set? ──YES──► delegate to gh.exe (respect explicit choice)
    │                                          ◄── Ralph sets this in Step -1
    │                                          ◄── ghe/ghp set this explicitly
    │
    └─ NO → detect from git remote URL
         │
         ├─ Remote matches "tamirdresher_microsoft"
         │  └─► GH_CONFIG_DIR = ~/.config/gh-emu
         │
         ├─ Remote matches "tamirdresher/"
         │  └─► GH_CONFIG_DIR = ~/.config/gh-public
         │
         └─ No remote / no match
            └─► GH_CONFIG_DIR = ~/.config/gh-emu (default = work)

Components

ComponentFilePurpose
Transparent proxygh-proxy.ps1Auto-routes gh → correct GH_CONFIG_DIR
Token healthgh-proxy.ps1Test-GhTokenHealth / Repair-GhToken functions
Setup scriptsetup.ps1One-time installation of proxy + credential helper
Routing tableConfigurable in gh-proxy.ps1Maps remote URL patterns → config dirs

Routing Table

The proxy uses a regex routing table to match git remote URLs:

powershell
$script:GH_ROUTING_TABLE = @(
    @{ Pattern = 'tamirdresher_microsoft'; ConfigDir = "$HOME\.config\gh-emu";    Label = 'EMU' }
    @{ Pattern = 'tamirdresher/';          ConfigDir = "$HOME\.config\gh-public"; Label = 'Personal' }
)
$script:GH_DEFAULT_CONFIG = "$HOME\.config\gh-emu"  # Default to EMU (work context)

Token Health Monitor

Proactively check if tokens are valid before they break automation:

powershell
# Check all profiles
Test-GhTokenHealth

# Check specific profile
Test-GhTokenHealth -Profile emu

# Repair expired token (opens browser)
Repair-GhToken -Profile public

Git Credential Integration

After setup, git push/pull also respects GH_CONFIG_DIR:

powershell
git config --global credential.helper '!gh auth git-credential'

Setup

Quick Install

powershell
# From the plugin directory:
.\setup.ps1

# Or manually: dot-source the proxy in your $PROFILE
. "path\to\gh-proxy.ps1"
git config --global credential.helper '!gh auth git-credential'

Prerequisites

  • GitHub CLI (gh) installed and authenticated for both accounts
  • Isolated config dirs already created:
    • ~/.config/gh-emu/ — EMU/work account
    • ~/.config/gh-public/ — personal account
  • If not set up yet, run setup-gh-isolated-auth.ps1 first (from the team scripts)

Verify

powershell
# Token health check
Test-GhTokenHealth

# Should show both profiles healthy:
#   Name    Account                  Healthy Error
#   ----    -------                  ------- -----
#   emu     tamirdresher_microsoft   True
#   public  tamirdresher             True

# Test auto-routing (run from a personal repo)
cd ~/repos/some-personal-repo
gh api user --jq '.login'   # → tamirdresher

# Run from a work repo
cd ~/repos/some-emu-repo
gh api user --jq '.login'   # → tamirdresher_microsoft

Files

FileDescription
SKILL.mdThis skill document (AI reads this to understand the setup)
README.mdHuman-readable overview and install instructions
gh-proxy.ps1Transparent proxy function + token health monitor
setup.ps1One-time setup: installs proxy to $PROFILE, configures git credential helper
manifest.jsonPlugin metadata and version

Integration with Ralph

Ralph needs zero changes. Here's why:

  1. Ralph already sets GH_CONFIG_DIR in Step -1 (ralph-watch.ps1 lines 1086-1098)
  2. The proxy's FIRST check is "Is GH_CONFIG_DIR already set?" — if yes, it delegates immediately without overriding
  3. The proxy is a complete no-op when Ralph is running

Token Expiry Alerting

Add to Ralph's Step -1 for proactive monitoring:

powershell
$health = Test-GhTokenHealth -Profile $(if ($remoteUrl -match 'tamirdresher_microsoft') { 'emu' } else { 'public' })
if (-not $health.Healthy) {
    Write-Host "Token expired for $($health.Name). Manual re-auth needed." -ForegroundColor Red
}

Backward Compatibility

  • ghe / ghp explicit wrappers continue to work (they set GH_CONFIG_DIR, proxy respects it)
  • gh-auto-context.ps1 prompt hook becomes OPTIONAL (proxy handles auto-detection)
  • CMD wrappers (gh-emu.cmd, gh-personal.cmd) unchanged
  • Agents can gradually switch from ghe/ghp to bare gh for in-repo commands

For Squad Agents

You no longer need to use ghe/ghp for in-repo commands. The transparent proxy auto-detects the correct account. Use bare gh freely:

powershell
# These all auto-route correctly based on repo context:
gh pr list
gh issue create --title "Fix bug"
gh api user --jq '.login'

Still use ghe/ghp when:

  • Running commands outside a git repo (e.g., ghe repo list)
  • Explicitly targeting a specific account regardless of repo context

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Github Multi Account?

Transparent gh proxy that auto-routes commands to the correct GitHub account based on repo context. Uses GH_CONFIG_DIR isolation — no more account-switching chaos.

Firwat Github Multi Account op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Github Multi Account besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Github Multi Account an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/tamirdresher/squad-skills/tree/main/plugins/github-multi-account an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Github Multi Account benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Github Multi Account benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Github Multi Account domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Github Multi Account gratis?

Jo. De Skill gëtt vum tamirdresher ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇