brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: an ask rule makes Claude Code check with you before every git push

Claude
~/tips/tip-claude-permissions-ask-git-push

"ask": ["Bash(git push *)"]

Forces a confirmation prompt for chosen commands, even in modes that would allow them.

Besides allow and deny, Claude Code permissions have a third list that gets less attention: ask.

{
  "permissions": {
    "ask": ["Bash(git push *)"]
  }
}

With this rule, Claude Code always stops and asks before it runs git push with any arguments. That holds even in acceptEdits or bypassPermissions mode, and even when an allow rule like Bash(git *) would match the same command. Rules are checked in a fixed order: deny first, then ask, then allow. The first match wins, and a more specific allow rule doesn’t change that.

In my view ask is a good fit for commands that are fine most of the time but should never happen unseen. Pushing, deploying, npm publish. Deny would block them completely, which is too strict when you do want Claude to push after you’ve looked.

In dontAsk mode a matching call is refused instead of prompting, since nobody is there to answer.

The rule matches how the command is written. git -C . push starts differently and slips past Bash(git push *), and so does a push inside a script Claude runs. So treat ask as a seatbelt for the normal case, not as a security boundary. For that, the docs point to hooks and the sandbox.

Further reading: permissions.ask setting, Configure permissions

More Claude tips /recap /focus /skill-doctor /autocompact 500k claude purge ~/work/my-repo --dry-run All Claude tips (83) All topics

Link