yamadashy/repomix · error · RepomixError

Git is not installed or not in the system PATH.

Error message

Git is not installed or not in the system PATH.

What it means

Remote packing relies on git for listing remote refs and performing shallow clones. performGitClone first checks deps.isGitInstalled() and throws this RepomixError when the git executable cannot be found, aborting the remote operation before any network work (src/cli/actions/remoteAction.ts:223).

Source

Thrown at src/cli/actions/remoteAction.ts:223

  return result;
};

/**
 * Performs git clone operation with spinner and error handling
 */
const performGitClone = async (
  repoUrl: string,
  tempDirPath: string,
  cliOptions: CliOptions,
  deps: {
    isGitInstalled: typeof isGitInstalled;
    getRemoteRefs: typeof getRemoteRefs;
    execGitShallowClone: typeof execGitShallowClone;
  },
): Promise<void> => {
  // Check if git is installed only when we actually need to use git
  if (!(await deps.isGitInstalled())) {
    throw new RepomixError('Git is not installed or not in the system PATH.');
  }
  // Get remote refs
  let refs: string[] = [];
  try {
    refs = await deps.getRemoteRefs(parseRemoteValue(repoUrl).repoUrl);
    logger.trace(`Retrieved ${refs.length} refs from remote repository`);
  } catch (error) {
    logger.trace('Failed to get remote refs, proceeding without them:', redactErrorMessage(error));
  }

  // Parse the remote URL with the refs information
  const parsedFields = parseRemoteValue(repoUrl, refs);

  const spinner = new Spinner('Cloning repository...', cliOptions);

  try {
    spinner.start();

View on GitHub (pinned to f465ad9093)

Solutions

  1. Install git (e.g. `apt-get install -y git`, `brew install git`, or add it to your Dockerfile).
  2. If git is installed, fix PATH so `git --version` succeeds in the same shell running repomix.
  3. As a fallback, download the repository archive manually and run repomix on the local directory instead of --remote.

Example fix

# Dockerfile before
FROM node:20-slim
RUN npm i -g repomix
# after
FROM node:20-slim
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
RUN npm i -g repomix
Defensive patterns

Strategy: try-catch

Validate before calling

const { execFileSync } = require('child_process');
try { execFileSync('git', ['--version'], { stdio: 'ignore' }); }
catch { throw new Error('git is required for repomix --remote'); }

Type guard

const isGitAvailable = async (): Promise<boolean> => {
  try { await exec('git', ['--version']); return true; } catch { return false; }
};

Try / catch

try {
  await repomixRun(['--remote', url]);
} catch (e) {
  if (String(e.message).includes('Git is not installed')) {
    throw new Error('Install git (apt-get install -y git / brew install git) and re-run');
  }
  throw e;
}

Prevention

When it happens

Trigger: `repomix --remote <url>` (or remote shorthand `repox owner/repo`) on a machine where git is not installed or is absent from PATH; container/CI images without git; restricted environments where PATH is stripped.

Common situations: Minimal Docker images (alpine/slim) lacking git; fresh CI runners with incomplete toolchains; Windows systems where git exists only in a non-PATH install directory; npx-based usage where the host has node but not git.

Related errors


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/b7815a7179d13500. Report an issue: GitHub.