Back to Home

Documentation

Gyti

Installation

Install Gyti globally using npm:

npm install -g gyti

After installation, verify it's working:

gyti --version

Quick Setup

On first run, Gyti will automatically guide you through setup. You can also manually run setup:

gyti setup

This will prompt you to choose between:

  • Gyti Backend (Recommended) - Uses the hosted Gyti service
  • Self-hosted - Use your own AI provider (OpenAI, Anthropic, Ollama, etc.)

After setup, authenticate with the backend:

gyti login

Then install the Git hook (globally by default, works for all repos):

gyti install
# Global installation (default)
gyti install --local
# Per-repository installation

Development

If you're developing or modifying the CLI, you need to rebuild after making changes:

cd ~/gyti/cli
npm run build
npm link --force
gyti install # Reinstall hook if needed

This rebuilds the TypeScript code and updates the globally linked command.

Usage

Once installed, just commit as usual. The tool will automatically generate or enhance your commit message:

git add .
git commit

You can also use git commit -m "." and the tool will replace it with a generated message.

Dry Run

Test the message generation without committing:

gyti generate

Configuration

View Current Configuration

Check your current settings:

gyti config

Backend URL

Set the backend API URL (default: https://www.gyti.ai/api):

gyti config --backend-url https://www.gyti.ai/api
# Production (default)
gyti config --backend-url http://localhost:3000/api
# Local development

API Key

Set your API key for authentication (if required by your backend):

gyti config --api-key your-api-key-here

Your API key is stored securely in your system's config directory.

Verbose Output

Enable or disable verbose logging:

# Enable verbose mode
gyti config --verbose
# Disable verbose mode
gyti config --no-verbose

Skip AI Generation

Skip AI generation globally (useful for testing or when you want to write messages manually):

# Skip AI by default
gyti config --skip-ai
# Re-enable AI generation
gyti config --no-skip-ai

Interactive Refinement

Enable or disable interactive refinement of commit messages (enabled by default):

# Disable interactive refinement
gyti config --no-interactive
# Re-enable interactive refinement
gyti config --interactive

Authentication

When using the Gyti backend, you need to authenticate with your account:

Login

Authenticate with email/password or OAuth (GitHub, Google):

gyti login

This will open your browser for authentication. Press Enter when prompted to open the browser.

Logout

Sign out and clear authentication tokens:

gyti logout

Environment Variables

You can also configure Gyti using environment variables:

GYTI_SKIP=true

Skip AI generation for a specific commit. Useful for one-off commits.

GYTI_SKIP=true git commit
GYTI_VERBOSE=true

Enable verbose output for debugging. Shows detailed error messages and generation status.

GIT_GYTI_SKIP=true

Alternative environment variable name for skipping AI generation.

Backend Setup

Gyti requires a backend API to generate commit messages. You can use the provided Next.js backend or set up your own.

Using the Default Backend

Start the Next.js backend server:

cd web
npm install
echo "OPENAI_API_KEY=sk-..." > .env.local
npm run dev

The backend will run on http://localhost:3000 by default.

Self-Hosted Mode

You can use your own AI provider instead of the Gyti backend. Run setup and choose "Self-hosted":

gyti setup

Supported providers:

  • OpenAI (GPT models)
  • Anthropic (Claude models)
  • Ollama (Local models)
  • Groq
  • Together AI
  • Custom OpenAI-compatible APIs

Troubleshooting

Hook not running?

Make sure you ran gyti install in your repository.

gyti install

API connection errors?

Check your backend URL and ensure the server is running:

gyti config
# Check current backend URL
curl http://localhost:3000/api/commits/generate
# Test backend connectivity

Timeout issues?

The tool automatically retries failed requests. If timeouts persist:

  • Check your network connection
  • Verify your backend is responding
  • Enable verbose mode for detailed error messages: GYTI_VERBOSE=true git commit

Uninstall the hook

To remove Gyti from a repository:

rm .git/hooks/prepare-commit-msg

Examples

Basic Workflow

# Stage your changes
git add src/components/Button.tsx
# Commit (Gyti will generate message)
git commit
# Output: feat: add Button component with variants

Enhancing Existing Messages

# Provide a draft message
git commit -m "fix bug"
# Gyti will enhance it to:
fix: resolve authentication error in login flow
- Handle expired token refresh
- Add proper error handling

Skip AI for One Commit

GYTI_SKIP=true git commit -m "chore: update dependencies"