Skip to content

Commit f97b05e

Browse files
chore(security): block direct git push to master/main branches (#3157)
Add deny patterns to prevent Claude Code from pushing directly to master or main, enforcing the PR-only workflow for protected branches.
1 parent 251183b commit f97b05e

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.claude/settings.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,22 @@
243243
"pattern": "git push -f *",
244244
"reason": "Force push without lease is not allowed — use --force-with-lease"
245245
},
246+
{
247+
"pattern": "git push origin master",
248+
"reason": "Never push directly to master — use a feature branch and open a PR"
249+
},
250+
{
251+
"pattern": "git push origin main",
252+
"reason": "Never push directly to main — use a feature branch and open a PR"
253+
},
254+
{
255+
"pattern": "git push * master",
256+
"reason": "Never push directly to master — use a feature branch and open a PR"
257+
},
258+
{
259+
"pattern": "git push * main",
260+
"reason": "Never push directly to main — use a feature branch and open a PR"
261+
},
246262
{
247263
"pattern": "npm publish",
248264
"reason": "Package publishing requires explicit approval"

0 commit comments

Comments
 (0)