{"record":{"id":"8a2a99927f2ea7d8","repo":"gitbutlerapp/gitbutler","slug":"bare-repositories-are-not-supported-8a2a99","errorCode":null,"errorMessage":"bare repositories are not supported","messagePattern":"bare repositories are not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gitbutler-project/src/project.rs","lineNumber":324,"sourceCode":"    /// Panics if it was not.\n    pub fn unwrap_project(self) -> Project {\n        match self {\n            AddProjectOutcome::Added(p) => p,\n            _ => panic!(\"called `AddProjectOutcome::unwrap_project()` on a non-project outcome\"),\n        }\n    }\n\n    /// Try to get the `Project`, returning an error if it was not added.\n    pub fn try_project(self) -> anyhow::Result<Project> {\n        match self {\n            AddProjectOutcome::Added(p) => Ok(p),\n            AddProjectOutcome::AlreadyExists(_) => Err(anyhow::anyhow!(\"project already exists\")),\n            AddProjectOutcome::PathNotFound => Err(anyhow::anyhow!(\"project path not found\")),\n            AddProjectOutcome::NotADirectory => {\n                Err(anyhow::anyhow!(\"project path is not a directory\"))\n            }\n            AddProjectOutcome::BareRepository => {\n                Err(anyhow::anyhow!(\"bare repositories are not supported\"))\n            }\n            AddProjectOutcome::NonMainWorktree => {\n                Err(anyhow::anyhow!(\"non-main worktrees are not supported\"))\n            }\n            AddProjectOutcome::NoWorkdir => Err(anyhow::anyhow!(\"no workdir found for repository\")),\n            AddProjectOutcome::NoDotGitDirectory => {\n                Err(anyhow::anyhow!(\"no .git directory found in repository\"))\n            }\n            AddProjectOutcome::ReftableRefFormatUnsupported => Err(anyhow::anyhow!(\n                \"unsupported repository reference format: reftable\"\n            )),\n            AddProjectOutcome::NotAGitRepository(msg) => {\n                Err(anyhow::anyhow!(\"not a git repository: {msg}\"))\n            }\n        }\n    }\n}\n","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/gitbutler-project/src/project.rs#L306-L342","documentation":"try_project maps AddProjectOutcome::BareRepository to this error. The path points to a bare git repository (one without a working tree), which GitButler cannot manage because its virtual-branch model requires a checked-out working directory.","triggerScenarios":"Adding a bare repo directory — one created with `git init --bare` or `git clone --bare`, typically recognizable by containing HEAD/objects/refs directly instead of a `.git` subdirectory.","commonSituations":"Pointing GitButler at a server-side repo directory (e.g. `/srv/git/project.git`), a mirror clone, or a shared bare repo used for push/pull.","solutions":["Clone the bare repo to a working clone (`git clone <path>.git`) and add the clone instead.","If you have an existing bare repo, create a non-bare working copy: `git clone --no-hardlinks <bare-path> <workdir>`.","Detect bare repos up front (`git rev-parse --is-bare-repository`) and skip adding them."],"exampleFix":"// before\nlet project = add_project(server_repo_path)?.try_project()?;\n// after\nlet output = Command::new(\"git\")\n    .args([\"rev-parse\", \"--is-bare-repository\"])\n    .current_dir(&server_repo_path)\n    .output()?;\nif output.stdout == b\"true\\n\" {\n    return Err(\"add a working clone, not a bare repository\".into());\n}\nlet project = add_project(server_repo_path)?.try_project()?;","handlingStrategy":"validation","validationCode":"let out = std::process::Command::new(\"git\")\n    .args([\"rev-parse\", \"--is-bare-repository\"])\n    .current_dir(path)\n    .output()?;\nlet is_bare = out.stdout == b\"true\\n\";\nif is_bare { return Err(\"bare repositories are not supported\".into()); }","typeGuard":null,"tryCatchPattern":"match outcome.try_project() {\n    Err(e) if e.to_string() == \"bare repositories are not supported\" => {\n        // offer to clone the bare repo into a working copy first\n        offer_clone_flow(&path)?;\n    }\n    other => other,\n}","preventionTips":["Never add `<repo>.git` server directories to GitButler.","Detect bare repos (directory containing HEAD, objects/, refs/ but no .git) before adding.","Clone bare repos into working clones for local development."],"tags":["git","project","bare-repository","unsupported"],"backgroundTag":"bare-repository-unsupported","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}