seuthootDev

Claude Gh Guard — Git skill for Claude Code

Git community

Stop Claude Code from committing to your work repo with your personal GitHub account.

How to install Claude Gh Guard

This entry records only its repository, not the path inside it, so there is no exact command to give. Open seuthootDev/claude-gh-guard and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Gh Guard does

Stop Claude Code from committing to your work repo with your personal GitHub account.

Alternatives in Git

  • Claude Relay Service — GitHub Repo stars Self-built Claude code mirror service supporting multi-account switching Relay service 9.9k ★
  • TDD Guard — by Nizar Selander - A hooks-driven system that monitors file operations in real-time and blocks changes that v 1.9k ★
  • Destructive Command Guard — The Destructive Command Guard (dcg) is for blocking dangerous git and shell commands from being executed by ag 869 ★

README

claude-gh-guard

![claude-gh-guard: stop Claude Code from committing to your work repo with your personal GitHub account](assets/social-preview.png)

[![npm version](https://img.shields.io/npm/v/claude-gh-guard)](https://www.npmjs.com/package/claude-gh-guard) [![npm downloads](https://img.shields.io/npm/dm/claude-gh-guard)](https://www.npmjs.com/package/claude-gh-guard) [![CI](https://github.com/seuthootDev/claude-gh-guard/actions/workflows/ci.yml/badge.svg)](https://github.com/seuthootDev/claude-gh-guard/actions/workflows/ci.yml) [![node](https://img.shields.io/node/v/claude-gh-guard)](https://www.npmjs.com/package/claude-gh-guard) [![license](https://img.shields.io/npm/l/claude-gh-guard)](LICENSE)

Stop Claude Code from committing to your work repo with your personal GitHub account.

It adds two things to Claude Code: a status line segment that always shows which GitHub identity is in play for the current repo, and a `PreToolUse` hook that blocks `git commit`, `git push` and `gh pr create` when the identity is definitely the wrong one. Zero runtime dependencies, Node >= 18.

**Right account** — the status line confirms the GitHub identity for this repo, followed by the Claude account in use:

![Status line showing a matching GitHub account](assets/match.png)

**Wrong account** — the status line turns red (here the SSH key still belongs to the right account, so it is shown too) and `gh pr create` is blocked with the fix:

![Status line showing a mismatch and the hook denying gh pr create](assets/mismatch.png)

**Nothing to check** — outside a GitHub repo (here: no remote yet) the segment is grey and nothing is blocked:

![Status line showing an untracked repo without a remote](assets/no-remote.png)

Install

npx claude-gh-guard init

or

npm i -g claude-gh-guard && claude-gh-guard init

`init`:

  • copies the CLI to ~/.claude-gh-guard/bin/cli.mjs
  • backs up your settings.json
  • sets the status line to the guard; an existing status line i