◉CLAUDE LABJP
●2.1.301 — Adds the vim % motion, LaTeX math rendering in the VS Code panel, and a retry-watchdog limit for usage-limit waits (10/15)●2.1.299 — Conversations over 200K tokens left idle about 54 minutes get compacted; MCP allow rules now match only the server they name●SONNET 4.5 — Retires on the Claude API on 11/30, 45 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●FAST MODE — Opus 5.5 fast mode is out of research preview and no longer needs the beta header (10/15)●NEW — I Put a Ten-Line Promise File at the To…●2.1.301 — Adds the vim % motion, LaTeX math rendering in the VS Code panel, and a retry-watchdog limit for usage-limit waits (10/15)●2.1.299 — Conversations over 200K tokens left idle about 54 minutes get compacted; MCP allow rules now match only the server they name●SONNET 4.5 — Retires on the Claude API on 11/30, 45 days left. Migrate to Sonnet 5.5●WINDOWS — Reports say hooks break silently only on Japanese-locale Windows; check the character encoding first●FAST MODE — Opus 5.5 fast mode is out of research preview and no longer needs the beta header (10/15)●NEW — I Put a Ten-Line Promise File at the To…
Articles/Claude Code
⟐ Claude Code/2026-07-14Advanced

One Day My Push Had an Extra Destination — Guarding Against /commit-push-pr Pushing to Remotes Beyond origin

The July 14 update made /commit-push-pr push to configured push remotes in addition to origin. Convenient, but if you keep a mirror or backup as a second remote, unintended pushes quietly multiply. Here is how to inventory which remotes you can push to, block anything off the allowlist with a pre-push hook, and keep unattended runs safe — with working code.

claude-code132git17push3automation109reliability18

✦ Premium Article

After a nightly run finished, I was scanning the push log out of habit when I noticed one line too many. The push to origin looked normal. Below it sat another remote name — familiar, but not one I expected to see there. I had registered that remote only to read from it. I never meant to push to it, yet there it was. The numbers and the diff were correct; the delivery just had one more destination than I intended. That small surplus was the behavior change the July 14 update introduced.

Until then, /commit-push-pr assumed a push to origin. After the update, it also auto-approves pushing to configured push remotes. If you run on a single remote, this change never surfaces. But as a personal developer juggling several sites, with even one mirror or backup registered as a second remote, your push quietly gains a destination. Today is my record of inventorying that change against my own nightly setup and narrowing it down to only the remotes I actually want to push to.

The opposite failure — a push that reports success but delivers nothing — I covered in when a push reports success but nothing lands. This piece guards the other side: something arriving where you never meant to send it.

Watching Only origin Hides the New Destination

We got away with ignoring push targets because, in most repositories, the target was a single remote called origin. Commit, push, one round trip — with only one remote in the loop, there is nothing to think about regarding where it lands.

This change quietly shifts that premise. When /commit-push-pr targets "origin plus configured push remotes," the moment you add a remote, your push destination can grow. And it happens not because you explicitly said "push here too," but as the command's default behavior.

The awkward part is that remotes are usually registered for reasons unrelated to pushing: to pull in someone's fork, to reference a mirror of another environment, or simply to inspect a diff. Each of those is a remote added to read — now silently eligible to be written to.

Which Remotes Can You Actually Push To Right Now

Before any fix, you need an accurate picture. The baseline is one line:

git remote -v

What people miss here is that fetch and push URLs are listed separately. The same remote name can point to different places for reading and for sending.

origin   https://github.com/you/site.git (fetch)
origin   https://github.com/you/site.git (push)
mirror   https://github.com/you/site.git (fetch)
mirror   git@backup.example:you/site.git (push)

A remote like mirror, whose push URL points somewhere else entirely, is exactly the destination you do not want to hit by accident. Beyond the remotes themselves, some settings decide the push target at a higher level. Three configs are worth pinning down.

SettingRoleCheck command
remote.<name>.pushurlSends that remote's pushes to a different URLgit config --get-all remote.mirror.pushurl
remote.pushDefaultChanges the default push remote away from origingit config --get remote.pushDefault
branch.<name>.pushRemoteOverrides the push target per branchgit config --get branch.main.pushRemote

With none of these set, a push heads straight to origin. With even one of them set, you cannot infer the target from the command alone. I keep a one-liner that dumps all three as a standard repository check.

git config --get-regexp '^(remote\.|branch\..*\.pushremote)' | grep -i 'push\|url'
✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Understand exactly what changed — /commit-push-pr now pushes to configured push remotes, not just origin — and read your git config to see every remote you can currently push to
✦Map the typical ways push targets grow through pushurl, remote.pushDefault, and per-branch pushRemote, and block anything off your allowlist with a pre-push hook
✦With a verification script you can confirm the hook actually fires, ready to drop into an unattended nightly run where no confirmation prompt is available
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⟐ Claude Code2026-04-30
Composing Claude Code Skills — Building Automation a Single Skill Can't Reach
A practical guide to going beyond one-skill-at-a-time and composing multiple Claude Code Skills into real workflows. Pipeline, branching, and meta-skill patterns with full implementation examples and the failure modes you should design against.
⟐ Claude Code2026-03-28
Running Claude Code × Playwright E2E Tests in Production — Pitfalls and Decision Criteria
Implementation patterns for running E2E tests with Claude Code and Playwright in production, plus how to measure whether the investment pays back. Includes the Cloudflare Workers and Pages preview deployment pitfalls, and a decision framework that indie developers can use to judge whether E2E tests are worth the investment.
⟐ Claude Code2026-03-24
How to Automate Game Development with Claude Code × unity-mcp — A Complete Workflow from Concept to Release
Learn how to combine Claude Code with unity-mcp to automate Unity game development. The hcg-workflows skill set provides an 8-phase workflow from planning to deployment.