{"record":{"id":"9f199e7393ccc84f","repo":"coleam00/Archon","slug":"cannot-determine-git-remote-for-repopath-no-gi","errorCode":null,"errorMessage":"Cannot determine git remote for ${repoPath}: no git remote is configured. Add one with `git remote add origin URL`, or use `--no-worktree` to run in the live checkout.","messagePattern":"Cannot determine git remote for (.+?): no git remote is configured\\. Add one with `git remote add origin URL`, or use `--no-worktree` to run in the live checkout\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/isolation/src/providers/worktree.ts","lineNumber":896,"sourceCode":"        getLog().info({ repoPath, remote: detected }, 'worktree.remote_auto_detected');\n      }\n      return detected;\n    }\n\n    // Distinguish no remotes from multiple non-origin remotes for an actionable error.\n    let remoteNames: string[] | null = null;\n    try {\n      const { stdout } = await execFileAsync('git', ['-C', repoPath, 'remote'], { timeout: 10000 });\n      remoteNames = stdout\n        .split(/\\r?\\n/)\n        .map(remote => remote.trim())\n        .filter(remote => remote.length > 0);\n    } catch {\n      // Best-effort for error message only\n    }\n\n    if (remoteNames?.length === 0) {\n      throw new Error(\n        `Cannot determine git remote for ${repoPath}: no git remote is configured. ` +\n          'Add one with `git remote add origin URL`, or use `--no-worktree` to run in the live checkout.'\n      );\n    }\n\n    const remoteList = remoteNames?.join(', ') ?? '<unknown>';\n    throw new Error(\n      `Cannot determine git remote for ${repoPath}: no 'origin' remote found and ` +\n        `multiple remotes exist (${remoteList}). ` +\n        'Set worktree.remote in .archon/config.yaml to specify which remote to use.'\n    );\n  }\n\n  /**\n   * Sync workspace with remote before creating a new worktree\n   * Ensures new work starts from the latest code on the base branch.\n   *\n   * Branch resolution:","sourceCodeStart":878,"sourceCodeEnd":914,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/isolation/src/providers/worktree.ts#L878-L914","documentation":"resolveRemote determines which git remote to use for fetch/push. It first honors `worktree.remote` config, then tries getDefaultRemote (which prefers 'origin'). When the repo has no remotes at all, Archon cannot sync or push worktree branches, so it throws with an actionable hint instead of failing later with a confusing git error.","triggerScenarios":"Creating a worktree (WorktreeProvider.create → resolveRemote) against a repo where `git remote` lists zero remotes and no `worktree.remote` is configured in `.archon/config.yaml`.","commonSituations":"A repo cloned via local path copy or `git init` without ever adding a remote; a workspace directory that is a git repo but was detached from its origin; CI checkouts created with `--depth 1` from a tarball rather than a clone.","solutions":["Add a remote: `git remote add origin <URL>`","Set the remote explicitly in `.archon/config.yaml` via `worktree.remote` only after a remote exists (this error means none do)","Run with `--no-worktree` to work in the live checkout instead of an isolated worktree","Verify with `git remote -v` that at least one remote is registered"],"exampleFix":"# before\ngit remote -v   # (empty)\n# after\ngit remote add origin git@github.com:acme/myrepo.git","handlingStrategy":"validation","validationCode":"import { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nconst execFileAsync = promisify(execFile);\nexport async function hasGitRemote(repoPath: string): Promise<boolean> {\n  const { stdout } = await execFileAsync('git', ['-C', repoPath, 'remote']);\n  return stdout.split(/\\r?\\n/).map(s => s.trim()).filter(Boolean).length > 0;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `git remote -v` after cloning and before enabling worktree isolation","Never strip the remote from Archon-managed workspace clones","Add `origin` immediately when importing a repo via local copy or `git init`","Prefer `--no-worktree` only when you intentionally want the live checkout"],"tags":["git","remote","configuration","worktree"],"backgroundTag":"missing-git-remote","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}