Skip to content

Configuration

Jonathan edited this page Feb 6, 2026 · 3 revisions

Configuration

gitai is highly configurable to suit your workflow. You can configure it using CLI flags, environment variables, or configuration files.

Precedence

The configuration loading order is (highest to lowest priority):

  1. CLI Flags: Arguments passed directly to the command (e.g., --provider=gpt).
  2. Environment Variables: Variables starting with GITAI_ (e.g., GITAI_AI_PROVIDER).
  3. Config Files: gitai.yaml, gitai.json, etc., in supported directories.
  4. Defaults: Built-in default values.

Configuration Files

gitai searches for a config file named gitai (with any supported extension like .yaml, .json, .toml) in the following directories, in order:

  1. /etc/gitai/
  2. $HOME/.config/gitai/
  3. $HOME/.gitai/
  4. The root of your Git repository
  5. The current working directory

Example gitai.yaml

ai:
  provider: "gpt" # gpt, anthropic, groq, deepseek, xai, gemini, ollama
  api_key: "sk-..." # Optional if using env vars
  model: ""         # Optional: override default model
  temperature: 0.7
  max_tokens: 256

ollama:
  path: "/usr/local/bin/ollama" # Required only for 'ollama' provider

suggest:
  editor: "builtin" # builtin, system, or command (e.g. "code -w")
  bullet_point: "-"
  hint: ""         # Provide a default hint
  no-hint: false   # Skip the hint prompt by default
  atomic: false    # Enable atomic commit suggestion by default

security:
  keywords: # Add custom sensitive keywords to block
    - "my_secret_token"
    - "internal_auth"

Environment Variables

All configuration keys can be set via environment variables. The prefix is GITAI_, and dots . are replaced with underscores _.

Config Key Environment Variable Description
ai.provider GITAI_AI_PROVIDER The AI backend to use.
ai.api_key GITAI_AI_API_KEY API key for the provider.
ai.model GITAI_AI_MODEL Specific model to use (e.g. gpt-4o).
ai.temperature GITAI_AI_TEMPERATURE Creativity of the AI (0.0 - 1.0).
ai.max_tokens GITAI_AI_MAX_TOKENS Max length of generated message.
ollama.path GITAI_OLLAMA_PATH Path to Ollama binary.
suggest.editor GITAI_SUGGEST_EDITOR Editor for commit messages.
suggest.bullet_point GITAI_SUGGEST_BULLET_POINT Bullet char for lists.
suggest.hint GITAI_SUGGEST_HINT Default hint for message generation.
suggest.no-hint GITAI_SUGGEST_NO-HINT Skip the hint prompt by default.
suggest.atomic GITAI_SUGGEST_ATOMIC Enable atomic commits by default.
security.keywords GITAI_SENSITIVE_KEYWORDS Comma-separated blocklist.

Note: Provider-specific legacy environment variables are also supported for backward compatibility and ease of use:

  • OPENAI_API_KEY
  • ANTHROPIC_API_KEY
  • GEMINI_API_KEY
  • GROQ_API_KEY
  • DEEPSEEK_API_KEY
  • XAI_API_KEY

Clone this wiki locally