git-ai

Enterprise Configuration

git-ai's behavior can be configured on developer machines by writing a JSON file in the user's home directory.

On Linux and macOS, this file is located at $HOME/.git-ai/config.json. On Windows, this file is located at %USERPROFILE%\.git-ai\config.json.

Options

All the options in config.json are optional, and will fall back to default values if not provided.

| --- | --- | --- | | git_path Path | The path to the (unaltered) git binary you distribute on developer machines | Defaults to whichever git is on the shell path | | ignore_prompts boolean flag | Prompts be excluded from authorship logs | false | | allow_repositories Path[] | Allow git-ai in only these remotes | If not specified or set to an empty list, all repositories are allowed. |

{
    "git_path": "/usr/bin/git",
    "ignore_prompts": false,
    "allow_repositories": [
        "https://github.com/acunniffe/git-ai.git"
    ]
}

Installing git-ai binary on developer machines

When git-ai is installed using the install.sh script (reccomended for personal use) the downloaded binary will be configured to handle calls to both git and git-ai, effectively creating a wrapper/proxy to git.

If you would like to create a custom installation here is what git-ai requires to works correctly cross platform:

Directory Structure

Unix/Linux/macOS:

  • Install the git-ai binary to: $HOME/.git-ai/bin/git-ai
  • Create a symlink: $HOME/.git-ai/bin/git$HOME/.git-ai/bin/git-ai
  • Create a symlink: $HOME/.git-ai/bin/git-og/path/to/original/git
  • Make the binary executable: chmod +x $HOME/.git-ai/bin/git-ai
  • On macOS only: Remove quarantine attribute: xattr -d com.apple.quarantine $HOME/.git-ai/bin/git-ai

Windows:

  • Install the binary to: %USERPROFILE%\.git-ai\bin\git-ai.exe
  • Create a copy: %USERPROFILE%\.git-ai\bin\git.exe (copy of git-ai.exe)
  • Create a batch file: %USERPROFILE%\.git-ai\bin\git-og.cmd that calls the original git executable
  • Unblock the downloaded files (PowerShell: Unblock-File)

PATH Configuration

Unix/Linux/macOS:

  • Add $HOME/.git-ai/bin to the beginning of the user's PATH
  • Update the appropriate shell config file (.zshrc, .bashrc, etc.)

Windows:

  • Add %USERPROFILE%\.git-ai\bin to the System PATH
  • The directory should be positioned before any existing Git installation directories to ensure the git-ai shim takes precedence

Configuration File

Create $HOME/.git-ai/config.json (or %USERPROFILE%\.git-ai\config.json on Windows) with the options outlined at the top of this page.

IDE/Agent Hook Installation

After installing the binary and configuring PATH, run:

git-ai install-hooks

This sets up integration with supported IDEs and AI coding agents (Cursor, VS Code with GitHub Copilot, etc.).

Reference Implementation

Our official install scripts implement all of these requirements and can serve as references:

These scripts handle edge cases like detecting the original git path, preventing recursive installations, and gracefully handling errors.