Use case

Give an agent its own Git identity

Create a dedicated Git identity role, SSH key, and GitHub host alias for an agent so automated commits and pushes stay separate from human identities.

When to use this

Use this page when you want an agent to work with its own Git identity instead of acting as your personal or work account.

If the agent should reuse an existing work, personal, or client role instead, use Use gitrole as an identity preflight for agents and automation instead of this page.

This is useful when you want:

  • automated commits to be clearly separate from human commits
  • a dedicated GitHub account for an agent
  • a repeatable repository setup for automation
  • to avoid mixing your own account with machine-driven work

How it works

A dedicated agent role gives the automation its own:

  • commit name
  • commit email
  • SSH key
  • GitHub account
  • GitHub SSH host alias

That means the repository can clearly distinguish:

  • human-authored work
  • agent-authored work

Create the agent role

Start by creating a role for the agent:

gitrole add agent \
  --name "Acme Build Agent" \
  --email "build-agent@acme.example" \
  --ssh ~/.ssh/id_ed25519_agent \
  --github-user acme-build-agent \
  --github-host github.com-acme-build-agent

Switch the repo to the agent role

Use the role locally when this repository should use the agent identity:

gitrole use agent --local

If the remote should also use the agent's SSH host alias, update it too:

gitrole remote set agent

Check that it worked

Run:

gitrole status

Use status for the fast daily check.

If something looks wrong, run:

gitrole doctor

Use doctor when you need the full explanation for the repository, remote, or SSH auth setup.

Why this is useful

This setup makes automation easier to reason about:

  • agent commits are visibly separate from human commits
  • SSH pushes use the agent account instead of your personal account
  • repository-local overrides keep the agent identity contained to the repositories that need it

That gives you a cleaner boundary between human work and machine-driven work.

If those repositories also need an explicit preferred-role policy, add repo-local identity policy with .gitrole after the agent setup is working.