{"record":{"id":"cb71c0bad12dd081","repo":"GoogleContainerTools/skaffold","slug":"no-git-program-on-path-w","errorCode":null,"errorMessage":"no 'git' program on path: %w","messagePattern":"no 'git' program on path: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/skaffold/git/gitutil.go","lineNumber":189,"sourceCode":"\t\tif _, err := r.Run(ctx, \"reset\", \"--hard\", fmt.Sprintf(\"origin/%s\", ref)); err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to clone repo %s: trouble resetting branch to origin/%s; run 'git clone <REPO>; stat <DIR/SUBDIR>' to verify credentials: %w\", g.Repo, ref, err)\n\t\t}\n\t}\n\treturn repoCacheDir, nil\n}\n\n// gitCmd runs git commands in a git repo.\ntype gitCmd struct {\n\t// Dir is the directory the commands are run in.\n\tDir string\n}\n\n// Run runs a git command.\n// Omit the 'git' part of the command.\nfunc (g *gitCmd) Run(ctx context.Context, args ...string) ([]byte, error) {\n\tp, err := findGit()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"no 'git' program on path: %w\", err)\n\t}\n\n\tcmd := exec.Command(p, args...)\n\tcmd.Dir = g.Dir\n\treturn util.RunCmdOut(ctx, cmd)\n}\n\nfunc tryUpdateRemoteOriginFetchURL(ctx context.Context, r gitCmd, newFetchURI string) {\n\toutput, err := r.Run(ctx, \"remote\", \"get-url\", \"origin\")\n\tif err != nil {\n\t\tlog.Entry(ctx).Debugf(\"failed to get remote origin fetch URI: %v\", err)\n\t\treturn\n\t}\n\n\tcurrentFetchURI := strings.TrimSpace(string(output))\n\tif currentFetchURI == newFetchURI {\n\t\treturn\n\t}","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/git/gitutil.go#L171-L207","documentation":"gitCmd.Run wraps every git invocation, and before exec'ing anything it calls findGit() to locate the git executable on PATH. If no `git` binary is found, this error is returned for every git operation, so the root cause is an environment problem, not a git command failure.","triggerScenarios":"Any call to gitCmd.Run (invoked by syncRepo, tryUpdateRemoteOriginFetchURL, and every git-based remote dependency sync) when findGit() cannot locate `git` in the PATH of the process running Skaffold.","commonSituations":"Minimal Docker/CI images (distroless, alpine without git, scratch) that don't ship git; PATH not set in the container or systemd service running Skaffold; git removed from a slimmed-down builder image.","solutions":["Install git in the environment/container running Skaffold (e.g. `apk add git`, `apt-get install -y git`).","Verify with `which git` in the same shell/container where Skaffold runs.","If git is installed in a nonstandard location, extend PATH before launching Skaffold.","Use a base image that includes git (e.g. a full debian/alpine image instead of distroless/scratch)."],"exampleFix":"// before (Dockerfile)\nFROM gcr.io/distroless/static\n// after\nFROM alpine:3.19\nRUN apk add --no-cache git","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(\"git\"); err != nil {\n\treturn fmt.Errorf(\"git is required but not found on PATH: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install git in every image/environment that runs Skaffold","Add an `exec.LookPath(\"git\")` startup check in scripts that use git-based features","Avoid distroless/scratch base images for Skaffold containers","Document PATH requirements in CI pipeline setup"],"tags":["git","environment","path"],"backgroundTag":"git-binary-not-found","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}