Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By nityeshagav0.1.1In 1 marketplace
Blocks git pushes to main, including cross-repo ones via -C, with a PreToolUse hook on every Bash call. Must be installed at user level to protect every repository.
Trending plugins
7-day copy clicks
Run automatically on Claude Code events. Claude doesn't decide.
1 caution to review before installing
A hook runs when Claude uses the Bash tool
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
git-safety, push-protection, main-branch, bypass-permissions, pre-tool-use-hook, accidental-push, git, hooks ·
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Prevents accidental pushes to main branch in Claude Code bypassPermissions mode.
When Claude Code runs with --dangerously-skip-permissions, it can execute git commands without user approval. This creates a security gap when this plugin is not installed at the user level.
Example scenario:
basics plugin installed at project level - you think it's protected-C flag:
git -C /path/to/RepoA push origin main
basics plugin does not help - hooks only run in the context of where Claude is running (Repo B)The key insight: Protection depends on where Claude runs, not on the target repository. A repo cannot protect itself from external -C commands. The only way to protect all your repositories is to install this plugin at the user level.
Important: This plugin must be installed at the user level to protect all repositories.
Add to your ~/.claude/settings.json:
{
"plugins": [
"https://github.com/nityeshaga/claude-code-essentials/tree/main/plugins/safe-push"
]
}
Or using the CLI:
claude /plugin add https://github.com/nityeshaga/claude-code-essentials/tree/main/plugins/safe-push
The plugin installs a PreToolUse hook that intercepts all Bash commands. When a git push command is detected, the hook:
main (e.g., git push origin main)main branch (e.g., git push)--all and --mirror pushes that would include mainThe hook handles all variations including:
git push origin maingit push origin HEAD:maingit push -u origin maingit -C /other/repo push origin main| Hook | Event | Description |
|---|---|---|
block-main-push | PreToolUse (Bash) | Blocks git pushes to main branch |
The same block-main-push hook is also included in the basics plugin. Use:
If you have basics installed at project level, you don't need safe-push for that specific project. However, installing safe-push at user level ensures protection across all your repositories.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub nityeshaga/claude-code-essentials --plugin safe-pushPlugins from other owners that cover similar ground