# ox init (/docs/cli/commands/init)



ox init [#ox-init]

Initialize a repository with SageOx, connecting it to the platform and setting up local configuration.

Usage [#usage]

<Terminal>
  <TerminalCommand>
    ox init [flags]
  </TerminalCommand>
</Terminal>

Run this command from the root of your Git repository after authenticating with `ox login`.

What Happens During Init [#what-happens-during-init]

When you run `ox init`, the CLI:

1. **Creates `.sageox/` directory** - Stores local configuration including `config.toml`
2. **Registers with SageOx** - Links your repository to your SageOx account
3. **Scans repository structure** - Analyzes your codebase conventions and patterns
4. **Configures defaults** - Sets up sensible defaults based on detected project type

Flags [#flags]

| Flag        | Description                             |
| ----------- | --------------------------------------- |
| `--name`    | Override the repository name            |
| `--team`    | Associate with a specific team          |
| `-y, --yes` | Skip confirmation prompts               |
| `--force`   | Reinitialize even if already configured |

The .sageox/ Directory [#the-sageox-directory]

```
.sageox/
├── config.toml       # Repository configuration (committed)
└── config.local.toml # Local overrides (gitignored)
```

Prerequisites [#prerequisites]

* Git repository with at least one commit
* Authenticated with `ox login`
* Write access to the repository root

Troubleshooting [#troubleshooting]

**"Not a git repository"** - Run from within an initialized Git repository.

**"Not authenticated"** - Run `ox login` first.

**"Repository already initialized"** - Use `--force` to reinitialize.

Related Commands [#related-commands]

* [ox login](/docs/cli/auth) - Authenticate before initializing
* [ox doctor](/docs/cli/doctor) - Diagnose configuration issues
* [ox prime](/docs/cli/prime) - Activate context for AI agents
