crewAIInc/crewAI · error · ValueError

Git is not installed or not found in your PATH.

Error message

Git is not installed or not found in your PATH.

What it means

Raised by crewai_cli.git.Repository.__init__ when `git --version` cannot be executed successfully — Git is either not installed or not on PATH. The Repository class shells out to git for every operation (status, add, commit, push), so it refuses to construct without a working git binary. It surfaces during deploy/create flows that wrap the project in a Repository.

Source

Thrown at lib/cli/src/crewai_cli/git.py:32

    ".mypy_cache/",
    ".pytest_cache/",
    ".ruff_cache/",
    ".tox/",
    ".venv/",
    "__pycache__/",
    "build/",
    "dist/",
    "env/",
    "venv/",
]


class Repository:
    def __init__(self, path: str = ".", fetch: bool = True) -> None:
        self.path = path

        if not self.is_git_installed():
            raise ValueError("Git is not installed or not found in your PATH.")

        if not self.is_git_repo:
            raise ValueError(f"{self.path} is not a Git repository.")

        if fetch:
            self.fetch()

    @staticmethod
    def is_git_installed() -> bool:
        """Check if Git is installed and available in the system."""
        try:
            subprocess.run(
                ["git", "--version"],  # noqa: S607
                capture_output=True,
                check=True,
                text=True,
            )
            return True

View on GitHub (pinned to 754d7323be)

Solutions

  1. Install Git: apt-get install -y git (Debian/alpine: apk add git), brew install git, or the Windows installer
  2. Ensure git is on PATH for the process: verify with `git --version` using the same environment the CLI runs in
  3. In Dockerfiles, add git before running crewai deploy steps
  4. For subprocess-launched contexts, inherit or set PATH so the git binary resolves

Example fix

# before (Dockerfile)
FROM python:3.12-slim
RUN crewai deploy create ...
# after
FROM python:3.12-slim
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
RUN crewai deploy create ...
Defensive patterns

Strategy: validation

Validate before calling

import shutil

def git_available() -> bool:
    return shutil.which("git") is not None

Type guard

def has_git() -> bool:
    import shutil
    return shutil.which("git") is not None

Try / catch

try:
    repo = Repository(path)
except ValueError as e:
    if "not installed" in str(e):
        raise SystemExit("Install git and ensure it is on PATH") from e
    raise

Prevention

When it happens

Trigger: Constructing Repository(path) or running `crewai deploy create/update` in a container (slim Docker images), minimal CI runner, or fresh OS where git is absent; also when PATH is stripped in a subprocess environment so shutil/exec lookup of `git` fails.

Common situations: python:3.x-slim or alpine Docker images without git installed; CI jobs using a minimal image; Windows environments where git.exe is not on PATH; restricted shells or cron jobs with minimal PATH.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/55d5f21cb2866d69. Report an issue: GitHub.