{"record":{"id":"55d5f21cb2866d69","repo":"crewAIInc/crewAI","slug":"git-is-not-installed-or-not-found-in-your-path","errorCode":null,"errorMessage":"Git is not installed or not found in your PATH.","messagePattern":"Git is not installed or not found in your PATH\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/cli/src/crewai_cli/git.py","lineNumber":32,"sourceCode":"    \".mypy_cache/\",\n    \".pytest_cache/\",\n    \".ruff_cache/\",\n    \".tox/\",\n    \".venv/\",\n    \"__pycache__/\",\n    \"build/\",\n    \"dist/\",\n    \"env/\",\n    \"venv/\",\n]\n\n\nclass Repository:\n    def __init__(self, path: str = \".\", fetch: bool = True) -> None:\n        self.path = path\n\n        if not self.is_git_installed():\n            raise ValueError(\"Git is not installed or not found in your PATH.\")\n\n        if not self.is_git_repo:\n            raise ValueError(f\"{self.path} is not a Git repository.\")\n\n        if fetch:\n            self.fetch()\n\n    @staticmethod\n    def is_git_installed() -> bool:\n        \"\"\"Check if Git is installed and available in the system.\"\"\"\n        try:\n            subprocess.run(\n                [\"git\", \"--version\"],  # noqa: S607\n                capture_output=True,\n                check=True,\n                text=True,\n            )\n            return True","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/cli/src/crewai_cli/git.py#L14-L50","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install Git: apt-get install -y git (Debian/alpine: apk add git), brew install git, or the Windows installer","Ensure git is on PATH for the process: verify with `git --version` using the same environment the CLI runs in","In Dockerfiles, add git before running crewai deploy steps","For subprocess-launched contexts, inherit or set PATH so the git binary resolves"],"exampleFix":"# before (Dockerfile)\nFROM python:3.12-slim\nRUN crewai deploy create ...\n# after\nFROM python:3.12-slim\nRUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*\nRUN crewai deploy create ...","handlingStrategy":"validation","validationCode":"import shutil\n\ndef git_available() -> bool:\n    return shutil.which(\"git\") is not None","typeGuard":"def has_git() -> bool:\n    import shutil\n    return shutil.which(\"git\") is not None","tryCatchPattern":"try:\n    repo = Repository(path)\nexcept ValueError as e:\n    if \"not installed\" in str(e):\n        raise SystemExit(\"Install git and ensure it is on PATH\") from e\n    raise","preventionTips":["Install git in Docker/CI images before crewai deploy steps","Verify `git --version` in the same environment that runs the CLI","Keep PATH intact when launching the CLI from subprocesses/cron"],"tags":["git","environment","cli","deployment"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}