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

# Repository Configuration

> Configure individual repository settings

Each repository has its own configuration in `.wit/config`.

## Core Settings

### Repository Format

```ini theme={null}
[core]
    repositoryformatversion = 1
```

The repository format version. wit uses version 1 by default.

### File Mode

```ini theme={null}
[core]
    filemode = true
```

Whether to track file permission changes.

| Value   | Description                  |
| ------- | ---------------------------- |
| `true`  | Track executable bit changes |
| `false` | Ignore permission changes    |

**When to disable:**

* Windows systems (no execute bit)
* Shared folders with permission issues

### Bare Repository

```ini theme={null}
[core]
    bare = false
```

Bare repositories have no working directory (used for servers).

## wit-Specific Settings

### Hash Algorithm

```ini theme={null}
[wit]
    hashAlgorithm = sha1
```

| Value    | Description                                         |
| -------- | --------------------------------------------------- |
| `sha1`   | Git-compatible (default) - works with GitHub/GitLab |
| `sha256` | More secure, but no Git remote compatibility        |

<Note>
  wit defaults to SHA-1 for full GitHub/GitLab compatibility. SHA-256 is available for wit-to-wit workflows that don't need Git remotes.
</Note>

### Auto-Stash on Switch

```ini theme={null}
[wit]
    autoStashOnSwitch = true
```

When enabled:

* Uncommitted changes are saved when switching branches
* Restored automatically when switching back

### Large File Handling

```ini theme={null}
[wit]
    largeFileThreshold = 2097152
    chunkSize = 2097152
```

| Key                  | Description                                |
| -------------------- | ------------------------------------------ |
| `largeFileThreshold` | Files larger than this are chunked (bytes) |
| `chunkSize`          | Size of each chunk (bytes)                 |

**Common values:**

| Size  | Bytes    |
| ----- | -------- |
| 1 MB  | 1048576  |
| 2 MB  | 2097152  |
| 5 MB  | 5242880  |
| 10 MB | 10485760 |

## User Information

```ini theme={null}
[user]
    name = Your Name
    email = you@example.com
    signingkey = ABC123
```

| Key          | Description                    |
| ------------ | ------------------------------ |
| `name`       | Your display name for commits  |
| `email`      | Your email for commits         |
| `signingkey` | GPG key for signing (optional) |

## Remote Configuration

```ini theme={null}
[remote "origin"]
    url = git@github.com:user/repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    pushurl = git@github.com:user/repo.git
```

| Key       | Description                            |
| --------- | -------------------------------------- |
| `url`     | Repository URL for fetch/push          |
| `fetch`   | Refspec for fetching                   |
| `pushurl` | Alternative URL for pushing (optional) |

### Multiple Remotes

```ini theme={null}
[remote "origin"]
    url = git@github.com:user/repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*

[remote "upstream"]
    url = git@github.com:original/repo.git
    fetch = +refs/heads/*:refs/remotes/upstream/*
```

## Branch Configuration

```ini theme={null}
[branch "main"]
    remote = origin
    merge = refs/heads/main
    rebase = true

[branch "develop"]
    remote = origin
    merge = refs/heads/develop
```

| Key      | Description                     |
| -------- | ------------------------------- |
| `remote` | Default remote for this branch  |
| `merge`  | Default branch to merge from    |
| `rebase` | Rebase instead of merge on pull |

## Scope Presets

```ini theme={null}
[scope "frontend"]
    paths = packages/frontend/

[scope "backend"]
    paths = packages/backend/,packages/api/

[scope "docs"]
    paths = docs/,*.md,README*
```

Use with:

```bash theme={null}
wit scope use frontend
```

## AI Configuration

```ini theme={null}
[ai]
    enabled = true
    model = gpt-4
    autoSuggest = false
```

| Key           | Description            | Default  |
| ------------- | ---------------------- | -------- |
| `enabled`     | Enable AI features     | `true`   |
| `model`       | AI model to use        | `gpt-4o` |
| `autoSuggest` | Auto-suggest on commit | `false`  |

## Web UI Configuration

```ini theme={null}
[web]
    port = 3847
    openBrowser = true
```

| Key           | Description           | Default |
| ------------- | --------------------- | ------- |
| `port`        | Web UI port           | `3847`  |
| `openBrowser` | Open browser on start | `true`  |

## Editing Configuration

### Using Commands

```bash theme={null}
# View
wit config --list
wit config user.name

# Set
wit config user.name "New Name"
wit config --global user.email "new@email.com"

# Unset
wit config --unset user.name

# Edit directly
wit config --edit
```

### Manual Editing

Open `.wit/config` in your editor:

```bash theme={null}
code .wit/config
```

## Example: Complete Configuration

```ini theme={null}
[core]
    repositoryformatversion = 1
    filemode = true
    bare = false
    ignorecase = false

[wit]
    hashAlgorithm = sha1
    largeFileThreshold = 5242880
    autoStashOnSwitch = true
    chunkSize = 2097152

[user]
    name = Alice Developer
    email = alice@company.com

[init]
    defaultBranch = main

[remote "origin"]
    url = git@github.com:company/project.git
    fetch = +refs/heads/*:refs/remotes/origin/*

[remote "upstream"]
    url = git@github.com:opensource/project.git
    fetch = +refs/heads/*:refs/remotes/upstream/*

[branch "main"]
    remote = origin
    merge = refs/heads/main

[branch "develop"]
    remote = origin
    merge = refs/heads/develop

[scope "frontend"]
    paths = packages/frontend/,packages/shared-ui/

[scope "backend"]
    paths = packages/backend/,packages/api/,packages/shared/

[ai]
    enabled = true
    model = gpt-4

[web]
    port = 3847
    openBrowser = true
```
