Configuration

Learn how to configure GitGuru to match your workflow and preferences.

API Key Setup

GitGuru requires a Google Gemini API key to enable AI features. You can get one for free from Google AI Studio.

Getting Your API Key

  1. Visit Google AI Studio
  2. Sign in with your Google account
  3. Click "Create API Key"
  4. Copy the generated key
Free Tier Limits
The free tier includes:
  • 15 requests per minute
  • 1 million tokens per minute
  • 1,500 requests per day

Adding Your API Key

Use the gg addkey command to configure your API key:

bash
gg addkey YOUR_GEMINI_API_KEY

This command will:

  • Validate your API key
  • Fetch available models for your account
  • Let you choose your preferred model
  • Store the configuration securely

Using Environment Variable

Alternatively, you can set the API key via environment variable:

bash
# Linux/macOS
export GEMINI_API_KEY="your-api-key"

# Windows (PowerShell)
$env:GEMINI_API_KEY="your-api-key"

# Windows (Command Prompt)
set GEMINI_API_KEY=your-api-key

Configuration Options

Use gg config to manage GitGuru settings:

bash
# Interactive configuration
gg config

# List all settings
gg config --list

# Get a specific value
gg config --get ai.model

# Set a specific value
gg config --set ai.commit.enabled=true

Available Settings

KeyTypeDescription
ai.modelstringAI model to use (e.g., gemini-1.5-pro)
ai.commit.enabledbooleanEnable AI commit messages by default
ai.diff.enabledbooleanEnable AI diff summaries by default
ai.status.enabledbooleanEnable AI status analysis by default
ai.log.enabledbooleanEnable AI log analysis by default

Model Selection

GitGuru supports multiple Gemini models, each with different capabilities:

ModelBest ForSpeed
gemini-3-flash-previewLatest generation preview, extremely fast and capable⚡ Ultra Fast
gemini-2.5-proBest for complex reasoning, coding, and deep analysis🐢 Slower
gemini-2.5-flashBest balance of speed and quality (recommended default)⚡ Very Fast
gemini-2.5-flash-liteLightweight and cheapest option for simple tasks🚀 Fastest
bash
# Set your preferred model
gg config --set ai.model=gemini-1.5-pro

# Or use the interactive config
gg config
Model Recommendation
For most users, gemini-1.5-flash provides the best balance between speed and quality. Use gemini-1.5-pro for complex code analysis tasks.

Configuration File

GitGuru stores configuration in ~/.gitguru/config.json:

json
{
  "apiKey": "YOUR_API_KEY",
  "model": "gemini-1.5-pro",
  "aiCommitEnabled": true,
  "aiDiffEnabled": true,
  "aiStatusEnabled": false,
  "aiLogEnabled": false
}
Security Note
The config file contains your API key. Make sure ~/.gitguru/ is not included in any version control or backup systems that might expose it.

Per-Command Overrides

You can override AI settings for individual commands using flags:

bash
# Force AI even if disabled by default
gg commit --ai
gg diff --ai
gg status --ai
gg log --ai

# Disable AI even if enabled by default
gg commit --no-ai
gg diff --no-ai
gg status --no-ai
gg log --no-ai

Here's a recommended configuration for most users:

bash
# Enable AI for commits (most useful)
gg config --set ai.commit.enabled=true

# Use fast model for everyday tasks
gg config --set ai.model=gemini-1.5-flash

# Keep other AI features manual (use --ai when needed)
gg config --set ai.diff.enabled=false
gg config --set ai.status.enabled=false
gg config --set ai.log.enabled=false

This setup gives you AI commit messages automatically while keeping other features available on-demand.

Troubleshooting

API Key Issues

If you're having problems with your API key:

bash
# Verify your key is set
gg config --get apiKey

# Re-add your key
gg addkey YOUR_NEW_KEY

# Check if environment variable is set
echo $GEMINI_API_KEY  # Linux/macOS
echo %GEMINI_API_KEY%  # Windows

Resetting Configuration

To reset GitGuru to default settings, delete the config file:

bash
# Linux/macOS
rm ~/.gitguru/config.json

# Windows
del %USERPROFILE%\.gitguru\config.json

Next Steps