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

Thrown when `AddProjectOutcome::BareRepository` is returned. The path is a valid git repository but was created/cloned with `--bare`, so it has no checked-out working tree. GitButler requires a non-bare repository because it manages working-directory branches.

Solutions

  1. Clone the repository non-bare (`git clone <url>`) and run setup on the clone.
  2. If you already have a bare repo, create a non-bare worktree/clone from it: `git clone <bare-path>`.
  3. Never run GitButler setup against server/hosting remotes (GitHub/GitLab server paths).

Example fix

// before
but setup ~/remotes/myrepo.git
// after
git clone ~/remotes/myrepo.git ~/work/myrepo
but setup ~/work/myrepo
Defensive patterns

Strategy: validation

Validate before calling

const { stdout } = await run(['git', '-C', repoPath, 'rev-parse', '--is-bare-repository']);
if (stdout.trim() === 'true') {
  throw new Error(`${repoPath} is bare; clone it non-bare first`);
}

Type guard

function isNonBareRepo(p: string): boolean {
  const r = cp.spawnSync('git', ['-C', p, 'rev-parse', '--is-bare-repository']);
  return r.status === 0 && r.stdout.toString().trim() === 'false';
}

Try / catch

try {
  await run(['but', 'setup', repoPath]);
} catch (e) {
  if (String(e).includes('is bare')) {
    console.error('Clone a working copy first: git clone <bare-path> <dest>');
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `but setup` against a bare repo (e.g. `myrepo.git` on a server, or a repo cloned with `git clone --bare`).

Common situations: Pointing GitButler at a server-side remote repository; CI artifacts of bare clones; accidentally cloning with `--bare` or `--mirror`.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/db2fa6b1f382ba31. Report an issue: GitHub.

Appendix: source

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

        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 58e5313667)