gh-account

Reviewed at commit aade36b

Runs each git push, pull, fetch, clone and gh command as the logged-in GitHub account that owns or belongs to the repository's owner, so Claude stops…

Made by
Vedant Andhale
What we checked

Rewrites git push, pull, fetch, clone and gh commands so each runs as the logged-in GitHub account that owns or belongs to the repository's owner, instead of the active gh account. It reads your gh logins and org lists, remembers owner-to-account choices, and never puts a token in the command text; nothing else leaves your machine.

Review details

Static review of the source at the pinned commit; not run. Registers session.start (clears caches, registers /gh-account), tool.call for Bash and PowerShell, and command.run (show map, forget). Before a shell command runs it splits the command, finds git push|pull|fetch|clone|ls-remote and gh steps, determines the owner from the URL, -R option or git remote -v, then picks the gh account whose login is the owner or the single account that is a member of it. It runs gh auth status (json or text), git remote -v, gh auth token --user LOGIN and gh api user/orgs (token passed only in the child process environment) to decide. A step that needs a different account is rewritten to GH_TOKEN="$(gh auth token --user ACCOUNT)" git -c credential.helper= -c credential.helper='!gh auth git-credential' ... (PowerShell: a temporary $env:GH_TOKEN restored in finally), so the token is expanded by the shell and does not appear in the command. Commands that already mention GH_TOKEN or GITHUB_TOKEN, contain subshells or substitutions, or are unclear are left unchanged, as is everything when gh uses an environment token. The owner-to-account map is kept in $.store; the status line shows how many commands were sent as which account. The only network traffic is gh api user/orgs to GitHub, made by the gh CLI. As a result a push can go out under an account other than the one active in gh, which is the stated purpose. gh itself was not reviewed.

What it uses
  • Reads your prompts: no
  • Sees tool calls: yes
  • Blocks or changes tool calls: yes
  • Reads or writes files: no
  • Runs programs on your machine: yes
  • Calls the model (uses tokens): no
  • Sends data over the network: no
  • Stores data: yes
  • Shows something on screen: yes
Hooked events
Screenshot of gh-account

Runs each git push, pull, fetch, clone and gh command as the logged-in GitHub account that owns or belongs to the repository's owner, so Claude stops switching gh accounts and retrying failed pushes.

Made this mod? Add a badge to your README

modsforClaude badge for gh-account

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/gh-account.svg)](https://modsforclaude.com/mods/gh-account/)

← All mods