Skip to content

git-mcp is configured exclusively through environment variables. No config file is required.

Environment Variables ​

VariableDefaultDescription
GIT_REPO_PATH—Default repository path. Used when repo_path is omitted from tool calls. Also settable via --repo-path CLI flag.
GIT_ALLOW_NO_VERIFYfalseSet to true to permit no_verify: true on git_commit and git_push. When false, the option is silently ignored.
GIT_ALLOW_FORCE_PUSHfalseSet to true to permit force: true on git_push. Without it, only force_with_lease is available.
GIT_AUTO_SIGN_COMMITSfalseSet to true to automatically sign every commit, even when sign: false is passed.
GIT_AUTO_SIGN_TAGSfalseSet to true to automatically sign every annotated tag.
GIT_SIGNING_KEY—Default signing key — a GPG key ID (e.g. A1B2C3D4) or path to an SSH key (e.g. /home/user/.ssh/id_ed25519).
GIT_SIGNING_FORMAT—Signing format: openpgp, ssh, or x509.

Setting Variables ​

Pass variables in the env block of your MCP server config. This scopes them to git-mcp only:

json
{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": ["-y", "@selfagency/git-mcp"],
      "env": {
        "GIT_REPO_PATH": "/home/user/myproject",
        "GIT_ALLOW_FORCE_PUSH": "true"
      }
    }
  }
}

Shell environment ​

Export variables before starting the server:

bash
export GIT_REPO_PATH=/home/user/myproject
export GIT_AUTO_SIGN_COMMITS=true
export GIT_SIGNING_KEY=A1B2C3D4
export GIT_SIGNING_FORMAT=openpgp
npx @selfagency/git-mcp

CLI flag ​

The --repo-path flag is equivalent to GIT_REPO_PATH:

bash
npx @selfagency/git-mcp --repo-path /home/user/myproject

Signing Configuration ​

To enable commit and tag signing:

  1. Ensure your Git signing setup works locally (git config --global user.signingkey etc.)
  2. Set GIT_SIGNING_KEY to your key ID or SSH key path
  3. Set GIT_SIGNING_FORMAT to openpgp, ssh, or x509
  4. Optionally set GIT_AUTO_SIGN_COMMITS=true and/or GIT_AUTO_SIGN_TAGS=true

Per-request signing can also be enabled by passing sign: true (and optionally signing_key) to git_commit or git_tag.

Security Flags ​

GIT_ALLOW_FORCE_PUSH and GIT_ALLOW_NO_VERIFY are opt-in only.

  • Without GIT_ALLOW_FORCE_PUSH=true, calling git_push with force: true falls back to a safe push (the force field is ignored).
  • Without GIT_ALLOW_NO_VERIFY=true, no_verify: true on git_commit / git_push is ignored and hooks always run.

This ensures that even if an AI agent or coding agent requests a dangerous operation, it cannot succeed unless you have explicitly permitted it at the server level.

See also: Safety model

External binaries ​

Some tools wrap binaries rather than reimplementing them:

ToolNeedsWithout it
git_flowgit-flow-nextReturns an install hint naming brew install git-flow-next and the releases page.
git_worktree flow_* actionsgit-flow-nextPath-addressed actions are unaffected.
git_but_check / git_jj_checkGitButler / JujutsuReport unavailability.

git-mcp resolves these through PATH and PATHEXT, so npm-installed .cmd shims work on Windows. Set GIT_FLOW_BINARY, BUT_BINARY, or JJ_BINARY to an absolute path if a binary is somewhere unusual.

Windows notes ​

Supported, and covered by CI on windows-latest. Two Git for Windows behaviours are worth knowing because they change what you see rather than whether something works:

  • core.autocrlf defaults to true, so diffs and status can show whole-file changes that are only line endings. git-mcp does not change this; set it yourself if it is not what you want.
  • Git for Windows ships a POSIX sh but not Unix file permissions, so hooks and filters run through sh.exe rather than directly. If a hook looks ignored, check that sh.exe is reachable relative to your git install.

Released under the MIT License.