{"record":{"id":"ed05ab654c822b11","repo":"gitbutlerapp/gitbutler","slug":"not-a-git-repository-msg","errorCode":null,"errorMessage":"not a git repository: {msg}","messagePattern":"not a git repository: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gitbutler-project/src/project.rs","lineNumber":337,"sourceCode":"            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":319,"sourceCodeEnd":342,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/gitbutler-project/src/project.rs#L319-L342","documentation":"try_project() maps AddProjectOutcome::NotAGitRepository(msg) to this error, embedding the underlying discovery message. It means the path given as a project is not recognized as a git repository at all.","triggerScenarios":"Calling try_project / add-project on a directory with no .git entry, an unreadable .git, or a malformed .git file pointer; path typos also land here depending on discovery.","commonSituations":"Adding the wrong folder after a refactor; .git deleted by a failed operation; case-sensitivity mismatches on macOS/Windows; passing a home directory instead of a repo.","solutions":["Run `git -C <path> status` to confirm the directory is a valid git repository.","Correct the path passed to add-project (use the worktree root).","Re-clone the repository if .git is missing or damaged.","Check .git file permissions (readable by the user running the app)."],"exampleFix":"// before\nadd_project(\"~/Documents\")                // not a repo\n// after\nadd_project(\"~/Documents/my-app\")        // directory containing .git","handlingStrategy":"validation","validationCode":"const isRepo = (() => { try { execSync(`git -C ${path} rev-parse --git-dir`); return true; } catch { return false; } })();\nif (!isRepo) throw new Error(`${path} is not a git repository`);","typeGuard":"const isGitRepo = (p) => { try { execSync(`git -C ${p} rev-parse --git-dir`, {stdio:'ignore'}); return true; } catch { return false; } };","tryCatchPattern":"if (let Err(e) = add_project(path) { if e.to_string().starts_with(\"not a git repository\") { show_path_picker(); } }","preventionTips":["Validate the target path with `git rev-parse --git-dir` before adding.","Store canonical project paths, not guessed ones.","Guard against .git deletion in cleanup scripts."],"tags":["git","path","validation"],"backgroundTag":"resource-not-found","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"}