gitbutlerapp/gitbutler · error

The repository at {} is bare. GitButler requires a non-bare

Error message

The repository at {} is bare. GitButler requires a non-bare repository.

What it means

Raised while registering a repository: `gitbutler_project` detected a bare repository and returned `AddProjectOutcome::BareRepository`. Bare repositories have no working directory, and GitButler's workspace model (virtual branches over a worktree) fundamentally requires one, so the project is rejected with an explicit message.

Source

Thrown at crates/but/src/command/legacy/setup.rs:242

        gitbutler_project::AddProjectOutcome::AlreadyExists(_) => {
            if let Some(out) = out.for_human() {
                writeln!(
                    out,
                    "  {}",
                    t.success.paint("✓ Repository already in project registry")
                )?;
            }
            Ok(ProjectStatus::AlreadyExists)
        }
        gitbutler_project::AddProjectOutcome::PathNotFound => Err(anyhow::anyhow!(
            "The path {} does not exist",
            repo_path.display()
        )),
        gitbutler_project::AddProjectOutcome::NotADirectory => Err(anyhow::anyhow!(
            "The path {} is not a directory",
            repo_path.display()
        )),
        gitbutler_project::AddProjectOutcome::BareRepository => Err(anyhow::anyhow!(
            "The repository at {} is bare. GitButler requires a non-bare repository.",
            repo_path.display()
        )),
        gitbutler_project::AddProjectOutcome::NonMainWorktree => Err(anyhow::anyhow!(
            "The repository at {} is a non-main worktree. GitButler requires the main worktree.",
            repo_path.display()
        )),
        gitbutler_project::AddProjectOutcome::NoWorkdir => Err(anyhow::anyhow!(
            "The repository at {} has no working directory. GitButler requires a working directory.",
            repo_path.display()
        )),
        gitbutler_project::AddProjectOutcome::NoDotGitDirectory => Err(anyhow::anyhow!(
            "The repository at {} has no .git directory. GitButler requires a .git directory.",
            repo_path.display()
        )),
        gitbutler_project::AddProjectOutcome::ReftableRefFormatUnsupported => Err(anyhow::anyhow!(
            "The repository at {} uses the currently unsupported reftable reference format.",
            repo_path.display()

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Point setup at a non-bare checkout of the repository instead (a normal working clone)
  2. If you only have the bare repo, create a working clone from it: `git clone /srv/git/project.git ~/work/project`
  3. Confirm bareness first with `git -C /the/path rev-parse --is-bare-repository` (prints true)

Example fix

# before: bare repository, rejected
but setup /srv/git/project.git

# after: use a non-bare working clone
git clone /srv/git/project.git ~/work/project
but setup ~/work/project
Defensive patterns

Strategy: validation

Validate before calling

let repo = gix::open(&repo_path)?;
if repo.is_bare() {
    anyhow::bail!("repository is bare; register a non-bare working clone instead");
}

Type guard

fn is_bare(out: &gitbutler_project::AddProjectOutcome) -> bool {
    matches!(out, gitbutler_project::AddProjectOutcome::BareRepository)
}

Try / catch

match add_project(&repo_path) {
    Ok(out) if is_bare(&out) => { /* clone a working copy and register that */ }
    Ok(out) => { /* other outcomes */ }
    Err(err) if err.to_string().contains("bare") => { /* bare-repo guidance */ }
    Err(err) => return Err(err),
}

Prevention

When it happens

Trigger: Running setup against a bare clone, e.g. `but setup /srv/git/project.git` or a path whose config has `bare = true` (typical for server-side/central repositories created with `git init --bare` or `git clone --bare`).

Common situations: Pointing tooling at the central server-side copy; using a bare mirror for backup/sync; automated scripts that glob `*.git` directories.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/db2fa6b1f382ba31. Report an issue: GitHub.