stablyai/orca · error

Repo has no configured git remotes.

Error message

Repo has no configured git remotes.

What it means

getDefaultRemote resolves the default push remote in priority order: branch.<default>.remote config → origin → the single configured remote → error. This throw fires when git remote returns an empty list — the repo has zero remotes configured, so there is no candidate to push/fetch to. The error is rethrown verbatim by the surrounding catch (only non-Error throws get rewrapped at :858).

Source

Thrown at src/main/git/repo.ts:849

    } catch {
      // Fall through: branch has no explicit remote configured.
    }
  }

  try {
    const { stdout } = await gitExecFileAsync(['remote'], gitExecOptions(path, options))
    const remotes = stdout
      .split('\n')
      .map((line) => line.trim())
      .filter(Boolean)
    if (remotes.includes('origin')) {
      return 'origin'
    }
    if (remotes.length === 1) {
      return remotes[0]
    }
    if (remotes.length === 0) {
      throw new Error('Repo has no configured git remotes.')
    }
    throw new Error(
      `Repo has multiple remotes (${remotes.join(', ')}) and no default is configured. Set branch.<default>.remote.`
    )
  } catch (error) {
    if (error instanceof Error) {
      throw error
    }
    throw new Error('Failed to resolve default remote for repo.')
  }
}

export async function searchBaseRefs(path: string, query: string, limit = 25): Promise<string[]> {
  return (await searchBaseRefDetails(path, query, limit)).map((entry) => entry.refName)
}

export async function searchBaseRefDetails(
  path: string,

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Add a remote before retrying: git remote add origin <url>.
  2. If the user intended a local-only workflow, do not call getDefaultRemote — short-circuit publish/fetch UI in that case.
  3. If the repo should have remotes, inspect .git/config for a corrupted/missing [remote] section.
  4. In tests, add at least a dummy remote to fixtures that exercise getDefaultRemote.

Example fix

// before
const remote = await getDefaultRemote(repoPath)

// after: add a remote first when none exist
const remotes = await readRemotes(repoPath)
if (remotes.length === 0) {
  await run('git', ['remote', 'add', 'origin', repoUrl], { cwd: repoPath })
}
const remote = await getDefaultRemote(repoPath)
Defensive patterns

Strategy: validation

Validate before calling

import { gitExecFileAsync } from './runner'

async function repoHasAnyRemote(path: string): Promise<boolean> {
  const { stdout } = await gitExecFileAsync(['remote'], { cwd: path })
  return stdout.split('\n').map((l) => l.trim()).filter(Boolean).length > 0
}

if (!(await repoHasAnyRemote(repoPath))) throw new Error('Add a remote before publishing (git remote add origin <url>).')

Type guard

function isNoRemotes(error: unknown): boolean {
  return error instanceof Error && error.message === 'Repo has no configured git remotes.'
}

Try / catch

if (!(await repoHasAnyRemote(repoPath))) {
  await promptAddRemote(repoPath)
}
try { return await getDefaultRemote(repoPath) }
catch (error) { if (isNoRemotes(error)) { await promptAddRemote(repoPath); return await getDefaultRemote(repoPath) } throw error }

Prevention

When it happens

Trigger: Calling getDefaultRemote(path, options) on a local-only repo (git init with no remote add), a fresh worktree whose parent repo has no remotes, a repo where all remotes were removed, or a corrupted .git/config that omits the [remote] sections.

Common situations: User opened a locally-initialised repo and tried to publish before adding a remote; a worktree was created from a repo that lost its remote config; CI cloned with --bare and no origin; a git init test fixture used without adding a remote; migration/tooling that stripped remotes during a reconfiguration.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/4b795820a16ad11f. Report an issue: GitHub.