{"record":{"id":"b7815a7179d13500","repo":"yamadashy/repomix","slug":"git-is-not-installed-or-not-in-the-system-path","errorCode":null,"errorMessage":"Git is not installed or not in the system PATH.","messagePattern":"Git is not installed or not in the system PATH\\.","errorType":"exception","errorClass":"RepomixError","httpStatus":null,"severity":"error","filePath":"src/cli/actions/remoteAction.ts","lineNumber":223,"sourceCode":"  return result;\n};\n\n/**\n * Performs git clone operation with spinner and error handling\n */\nconst performGitClone = async (\n  repoUrl: string,\n  tempDirPath: string,\n  cliOptions: CliOptions,\n  deps: {\n    isGitInstalled: typeof isGitInstalled;\n    getRemoteRefs: typeof getRemoteRefs;\n    execGitShallowClone: typeof execGitShallowClone;\n  },\n): Promise<void> => {\n  // Check if git is installed only when we actually need to use git\n  if (!(await deps.isGitInstalled())) {\n    throw new RepomixError('Git is not installed or not in the system PATH.');\n  }\n  // Get remote refs\n  let refs: string[] = [];\n  try {\n    refs = await deps.getRemoteRefs(parseRemoteValue(repoUrl).repoUrl);\n    logger.trace(`Retrieved ${refs.length} refs from remote repository`);\n  } catch (error) {\n    logger.trace('Failed to get remote refs, proceeding without them:', redactErrorMessage(error));\n  }\n\n  // Parse the remote URL with the refs information\n  const parsedFields = parseRemoteValue(repoUrl, refs);\n\n  const spinner = new Spinner('Cloning repository...', cliOptions);\n\n  try {\n    spinner.start();\n","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/cli/actions/remoteAction.ts#L205-L241","documentation":"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).","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Install git (e.g. `apt-get install -y git`, `brew install git`, or add it to your Dockerfile).","If git is installed, fix PATH so `git --version` succeeds in the same shell running repomix.","As a fallback, download the repository archive manually and run repomix on the local directory instead of --remote."],"exampleFix":"# Dockerfile before\nFROM node:20-slim\nRUN npm i -g repomix\n# after\nFROM node:20-slim\nRUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*\nRUN npm i -g repomix","handlingStrategy":"try-catch","validationCode":"const { execFileSync } = require('child_process');\ntry { execFileSync('git', ['--version'], { stdio: 'ignore' }); }\ncatch { throw new Error('git is required for repomix --remote'); }","typeGuard":"const isGitAvailable = async (): Promise<boolean> => {\n  try { await exec('git', ['--version']); return true; } catch { return false; }\n};","tryCatchPattern":"try {\n  await repomixRun(['--remote', url]);\n} catch (e) {\n  if (String(e.message).includes('Git is not installed')) {\n    throw new Error('Install git (apt-get install -y git / brew install git) and re-run');\n  }\n  throw e;\n}","preventionTips":["Install git in Docker/CI images before installing repomix.","Add a preflight `git --version` check to scripts that use --remote.","On Windows, ensure git's install dir is on PATH (or use Git Bash)."],"tags":["cli","git","environment","remote","repomix"],"backgroundTag":"git-not-installed","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}