gritHEAD → docs/init
Commands / Getting startedMarkdown

grit init

Create a new, empty repository.

grit init [--bare] [--ref-format <files|reftable>] [<path>]

Description

Creates an empty Git repository at <path>, or in the current directory when no path is given. The directory is created if it doesn't exist. A normal repository keeps its data in a .git directory next to your files. A bare repository has no working tree; the repository data is the directory itself, which is what you want for a repository that other people push to.

The first branch is main. It has no commits until you make one.

Use --ref-format reftable to initialize with Git's reftable ref backend (requires a reftable-capable Git for interoperability). The default is files (loose refs under refs/).

Options

Option Description
<path> Where to create the repository. Defaults to the current directory.
--bare Create a bare repository, with no working tree.
--ref-format Ref storage backend: files (default) or reftable.

JSON output

Pass --json for stable, scripting-friendly output:

Field Type Meaning
initialized boolean true when a new repository was created.
reinitialized boolean true when an existing repository was reinitialized in place (omitted when false).
path string Repository directory (the .git directory for a normal repository).
bare boolean Whether the repository is bare.
branch string Initial branch name.
ref_format string Ref storage backend (files or reftable).

Markdown output