gitconfig

A command for configuring Git, the system used to track changes to code. It can set up repository-specific SSH access or machine-wide aliases, templates, hooks, and ignore rules.

In plain words
What is it for?
Use it to configure Git locally or globally, choose and test an SSH key, and set shared Git defaults.
Why use it?
It helps avoid Git setup problems, including using the wrong GitHub account when several SSH keys are available.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/koolamusic/claudefiles/gitconfig
Clone the repo
git clone --depth 1 https://github.com/koolamusic/claudefiles
Per session 31 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,296 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00031 $0.01296
Opus 5 $0.00015 $0.00648
Sonnet 5 $0.00006 $0.00259
Haiku 4.5 $0.00003 $0.00130

Measured 2d ago against content hash 13fcd6a3ea05, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

gitconfig scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Enumerates the file system for secretshighData exfiltration

Searching home directories for .env, .ssh, .aws or credential files is reconnaissance for credential theft.

ls -la ~/.ssh/*.pub
commands/gitconfig.md · 160 lines

How it starts

The opening of the file, as written. The whole thing — 160 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context

This command configures git at two levels:

  • Local (per-repo): SSH key for multi-account GitHub setups
  • Global (machine-wide): aliases, commit template, ignore rules, hooks, and sane defaults

The git templates in this repo (dotfiles/) are inspired by thoughtbot/dotfiles.

Your task

Step 0: Ask scope

Ask the user: local (configure SSH key for this repo) or global (set up git config, templates, hooks for the whole machine)?


Local mode: Per-repo SSH key

When you have multiple GitHub accounts, SSH may authenticate with the wrong account because the SSH agent offers keys in order and GitHub accepts the first valid key.

Key insight: IdentitiesOnly=yes alone is NOT enough. Keys loaded in the SSH agent that match IdentityFile entries in ~/.ssh/config still get offered. You must also set IdentityAgent=none to fully bypass the agent.

Step 1: List available SSH keys

ls -la ~/.ssh/*.pub

Present the keys and ask which one to use.

Step 2: Test the selected key

ssh -o IdentitiesOnly=yes -o IdentityAgent=none -i ~/.ssh/<selected_key> -T [email protected]

Show which GitHub account the key maps to. Confirm with the user.

Step 3: Confirm current repo and remote

git remote -v

Step 4: Configure per-repo SSH command

git config core.sshCommand "ssh -o IdentitiesOnly=yes -o IdentityAgent=none -i ~/.ssh/<selected_key>"
Flag Purpose
IdentitiesOnly=yes Only use explicitly configured identity files
IdentityAgent=none Completely bypass SSH agent (prevents agent-cached keys from interfering)
-i <key> Specify exactly which private key to use

Step 5: Verify

git config --local core.sshCommand
ssh -o IdentitiesOnly=yes -o IdentityAgent=none -i ~/.ssh/<selected_key> -T [email protected]

Global mode: Machine-wide git setup

Read the git templates from this repo's dotfiles/ directory and install them system-wide.

Read the full file on GitHub · 160 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 160 lines · 31 tokens per session scan C 13fcd6a3ea05

Subscribe to this mod's changes

gitconfig is a command published in the GitHub repository koolamusic/claudefiles (132 stars, last pushed 3d ago), licensed MIT. It adds 31 tokens to every session and 1,296 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 1 finding (enumerates the file system for secrets). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.