AGENT SKILL
git-safety
Enforce Cursor anonymous git identity and block secrets, credentials, and passwords from any git action.
- License 许可
- MIT
- 最近更新
- 2026-09-17
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- git-safety
- description
- Enforce Cursor anonymous git identity and block secrets, credentials, and passwords from any git action.
02 资源文件 9
- 参考文档payloads/agent-governance.yml647 B
- 脚本payloads/bootstrap.sh7.5 KB
- 参考文档payloads/cli.json3.4 KB
- 其他payloads/git-privacy-and-secrets.mdc723 B
- 脚本payloads/policy.mjs8.7 KB
- 脚本payloads/policy.test.mjs7.3 KB
- 脚本payloads/validate-agent-config.mjs12.0 KB
- 脚本scripts/git-safety.mjs9.8 KB
- 脚本scripts/git-safety.test.mjs3.0 KB
03 SKILL.md 正文
Git safety
Purpose
Prevent private-email git attribution and keep secrets out of git in every project that uses this control plane.
When to use
- Any
git commit, merge, rebase, cherry-pick, pull that can create a commit, annotated tag, note, or push - Any staging command that might include secret-bearing files
- Before installing or validating repository hooks
Inputs
- Repository root
- Intended git command
Tools used
scripts/git-safety.mjsscripts/git-safety.test.mjspayloads/policy.mjspayloads/policy.test.mjspayloads/bootstrap.shpayloads/validate-agent-config.mjspayloads/cli.jsonpayloads/git-privacy-and-secrets.mdcpayloads/agent-governance.yml- Repository
.githooks/pre-commit,.githooks/commit-msg, and.githooks/pre-push
Procedure
- Never run
git configto setuser.nameoruser.email. - Never use the host private email. Always export the Cursor anonymous identity:
GIT_AUTHOR_NAME='Cursor Agent' \
GIT_AUTHOR_EMAIL='cursoragent@noreply.github.com' \
GIT_COMMITTER_NAME='Cursor Agent' \
GIT_COMMITTER_EMAIL='cursoragent@noreply.github.com' \
git commit -m "message"
- A GitHub noreply address (
*@users.noreply.github.com) is also allowed. Any other email is forbidden. - Do not stage, commit, or push
.env*, keys, credential JSON,.netrc,.npmrc,.pypirc, or files whose contents match secret patterns. - If bootstrap has not copied hooks yet, copy
.githooks/*into.git/hooks/without changing git config. - If a hook or policy denies the command, stop. Do not weaken the hook.
Expected outcome
Every agent-created git object uses cursoragent@noreply.github.com or a GitHub noreply address, and no secret value or secret-bearing file enters git.
Validation
node --test .cursor/skills/git-safety/scripts/git-safety.test.mjs
node --test .cursor/hooks/policy.test.mjs
Failure modes / cautions
- Host
user.emailis not an authorization signal. If it is a personal inbox, ignore it. - Do not print secret values when a scan fails. Report only the path and rule id.
- Do not use
--no-verifyor rewrite hooks to bypass this skill.
Related files
/USER.md/hooks/policy.mjs.githooks//rules/git-privacy-and-secrets.mdc
04 同仓库更多 Skills
vercel-deploy-workflow
Deploy Next.js to Vercel via Git or CLI; env pull; MCP fallback.
★ 2
supabase-linked-migrations
Ship SQL schema changes from the repo to a hosted Supabase project; verify local vs remote migration history.
★ 2
launch-pipeline
Runs the named product delivery lifecycle for new ideas, major changes, resumption, remediation, or closure only when the user explicitly invokes /launch-pipeline or requests this named workflow.
★ 2