Guide
Save and check your Git identity
Install gitrole, apply a saved role, and understand the identity checks.
Gitrole saves a Git name and email as a named role, applies that role to a repository or your global Git configuration, and checks the effective author and committer. It also observes the current default push destinations and supported SSH authentication.
Start here
- Install and update gitrole: choose npm or Homebrew and confirm the version.
- Use the right Git identity for this repo: save a role, apply it locally, and run the first check.
- Troubleshoot identity warnings: identify what a warning means and choose the next action.
The installation channels can publish different versions. The first-use guide includes the common HTTPS warning and the matching-pin exception; an applied role alone does not verify push credentials.
Choose a check
| Command | Use it to |
|---|---|
gitrole check commit |
Check saved commit identity and policy locally, without remote or SSH checks. |
gitrole current |
Find the saved role matching Git's effective author. |
gitrole status |
Read a concise identity and default push check. |
gitrole doctor |
Explain warnings and inspect each push destination. |
gitrole status --short --offline |
Read local checks without invoking SSH. HTTPS pin checks still apply. |
For status and doctor, exit 0 means aligned, 2 means warning, and 1 means the command failed. check commit is quiet on success, exits 2 for a local mismatch, and 1 for a failure. auth=na means authentication was skipped or does not apply; it does not prove credentials. No result guarantees a future commit's explicit author or a successful push.
Continue with a task
- Import the current Git identity: save the author Git already uses.
- Use repo-local identity policy: declare a default and allowed roles.
- Show gitrole in your shell prompt: use a local check and understand shell limitations.
- Check identity before a local commit: use the local guard and review copied-hook migration.
- Enable shell tab completion: load optional completion scripts.
- Verify identity before an agent commits: add check instructions to an authorized agent workflow.
- Give an agent its own Git identity: apply an identity whose account, key, and alias already exist.
- Fix pushes using the wrong GitHub account: inspect the selected push remote and SSH context.
- Use gitrole as an identity preflight: check an existing role in automation.
Reference
Use Commands for flags and side effects, and Machine-readable contracts for field vocabulary, JSON shapes, provenance, and exit codes.