> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Git Identity Configuration

> Configure custom git commit author identity for PraisonAI

Configure custom git commit author identity across PraisonAI CLI commands and internal services.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    subgraph "Git Identity Flow"
        Env[🔧 Environment] --> CLI[📝 CLI Commit]
        Env --> Checkpoint[💾 Checkpoints]
        Env --> Snapshot[📸 Snapshots]
        
        CLI --> Commit[✅ Git Commit]
        Checkpoint --> Commit
        Snapshot --> Commit
    end
    
    classDef env fill:#6366F1,stroke:#7C90A0,color:#fff
    classDef service fill:#F59E0B,stroke:#7C90A0,color:#fff
    classDef output fill:#10B981,stroke:#7C90A0,color:#fff
    
    class Env env
    class CLI,Checkpoint,Snapshot service
    class Commit output
```

## Quick Start

**1. Set Environment Variables**

Configure your git identity using environment variables:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
export PRAISONAI_GIT_USER_NAME="Your Name"
export PRAISONAI_GIT_USER_EMAIL="your.email@example.com"
```

**2. Use GitHub Noreply Email**

Protect your personal email on GitHub:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
export PRAISONAI_GIT_USER_NAME="YourUsername"
export PRAISONAI_GIT_USER_EMAIL="YourUsername@users.noreply.github.com"
```

**3. Test Configuration**

Verify the configuration works:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai commit -a
# Commits will now show: Your Name <your.email@example.com>
```

***

## How It Works

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
sequenceDiagram
    participant User
    participant PraisonAI
    participant Git
    
    User->>PraisonAI: Set environment variables
    User->>PraisonAI: Run command
    PraisonAI->>Git: Commit with custom identity
    Git-->>PraisonAI: Success
    PraisonAI-->>User: Commit created
```

PraisonAI reads identity configuration in this priority order:

| Priority | Method | Example |
| - | - | - |
| 1 | Explicit parameter | `CheckpointService(user_name="Custom")` |
| 2 | Environment variables | `PRAISONAI_GIT_USER_NAME` |
| 3 | Default values | `"PraisonAI"` |

***

## Environment Variables

| Variable | Description | Default |
| - | - | - |
| `PRAISONAI_GIT_USER_NAME` | Git user.name for commits | `"PraisonAI"` |
| `PRAISONAI_GIT_USER_EMAIL` | Git user.email for commits | Service-specific |

> [!NOTE]
>
> Default email varies by service:
>
> * CLI commands: No default (uses global git config)
> * CheckpointService: `"checkpoints@praison.ai"`
> * FileSnapshot: `"praison@snapshot.local"`

***

## Setup Methods

**Shell Configuration**

Add to your shell profile (`~/.bashrc`, `~/.zshrc`, `~/.bash_profile`):

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Personal identity
export PRAISONAI_GIT_USER_NAME="John Doe"
export PRAISONAI_GIT_USER_EMAIL="john@example.com"

# GitHub noreply (recommended)
export PRAISONAI_GIT_USER_NAME="johndoe"
export PRAISONAI_GIT_USER_EMAIL="johndoe@users.noreply.github.com"
```

Reload your shell:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
source ~/.zshrc  # or ~/.bashrc
```

**Session Only**

Set for current session only:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
export PRAISONAI_GIT_USER_NAME="Temporary User"
export PRAISONAI_GIT_USER_EMAIL="temp@example.com"

# Verify
echo $PRAISONAI_GIT_USER_NAME
echo $PRAISONAI_GIT_USER_EMAIL
```

**Project Specific**

Create a `.env` file in your project:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# .env
PRAISONAI_GIT_USER_NAME=ProjectUser
PRAISONAI_GIT_USER_EMAIL=project@example.com
```

Load before running PraisonAI:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
source .env
praisonai commit -a
```

***

## Affected Components

### CLI Commands

The `praisonai commit` command uses the environment variables for git author:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent

# Environment variables are automatically used
# No code changes needed
```

### Checkpoint Service

Internal checkpoints use the configured identity:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import CheckpointService

# Uses environment variables automatically
service = CheckpointService(workspace_dir="./project")

# Or override explicitly
service = CheckpointService(
    workspace_dir="./project",
    user_name="Override Name",
    user_email="override@example.com"
)
```

Alongside `user_name` / `user_email`, `CheckpointService` also accepts `max_file_size` (bytes, default 2 MB; `0` disables) to skip large files from the shadow commit. Files above the cap are left on disk.

### File Snapshot

File snapshots use the configured identity:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents.snapshot import FileSnapshot

# Uses environment variables automatically
snapshot = FileSnapshot(project_path="./project")

# Or override explicitly
snapshot = FileSnapshot(
    project_path="./project", 
    user_name="Override Name",
    user_email="override@example.com"
)
```

***

## Common Patterns

> **GitHub Integration**
>
> Using GitHub noreply email for privacy:
>
> ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> export PRAISONAI_GIT_USER_NAME="MervinPraison"
> export PRAISONAI_GIT_USER_EMAIL="MervinPraison@users.noreply.github.com"
> ```
>
> This ensures:
>
> * Commits are attributed to your GitHub account
> * Your personal email is not exposed
> * GitHub shows your profile picture and username

> **Team Environment**
>
> Set team-wide defaults using environment management:
>
> ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> # Development environment
> export PRAISONAI_GIT_USER_NAME="Dev Team"
> export PRAISONAI_GIT_USER_EMAIL="dev@company.com"
>
> # Production environment  
> export PRAISONAI_GIT_USER_NAME="Production Bot"
> export PRAISONAI_GIT_USER_EMAIL="production@company.com"
> ```

> **Multi-Project Setup**
>
> Different identities for different projects:
>
> ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> # Project A
> cd project-a
> export PRAISONAI_GIT_USER_NAME="Team A"
> export PRAISONAI_GIT_USER_EMAIL="team-a@company.com"
> praisonai commit -a
>
> # Project B
> cd ../project-b
> export PRAISONAI_GIT_USER_NAME="Team B" 
> export PRAISONAI_GIT_USER_EMAIL="team-b@company.com"
> praisonai commit -a
> ```

***

## Best Practices

> **Use GitHub Noreply Email**
>
> Always use GitHub's noreply email format to protect your privacy:
>
> ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> # Format: {username}@users.noreply.github.com
> export PRAISONAI_GIT_USER_EMAIL="yourusername@users.noreply.github.com"
> ```
>
> Benefits:
>
> * Commits link to your GitHub profile
> * Personal email stays private
> * Works with all GitHub features

> **Set in Shell Profile**
>
> Add variables to your shell configuration for persistence:
>
> ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> # ~/.zshrc or ~/.bashrc
> export PRAISONAI_GIT_USER_NAME="Your Name"
> export PRAISONAI_GIT_USER_EMAIL="your@email.com"
> ```
>
> This ensures the configuration persists across sessions.

> **Verify Configuration**
>
> Always verify your configuration before committing:
>
> ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> echo "Name: $PRAISONAI_GIT_USER_NAME"
> echo "Email: $PRAISONAI_GIT_USER_EMAIL"
>
> # Test with a small commit
> praisonai commit -a
> git log --oneline -1  # Check the author
> ```

> **Override When Needed**
>
> Use explicit parameters for special cases:
>
> ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
> # For automated systems
> service = CheckpointService(
>     workspace_dir="./project",
>     user_name="Automated System",
>     user_email="automation@company.com"
> )
> ```

***

## Related

> **[AI Commit](https://praison.ai/docs/cli/commit.md)**
>
> Generate AI-powered commit messages

> **[Git Integration](https://praison.ai/docs/cli/git-integration.md)**
>
> PraisonAI git workflow integration


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.