Report #97703
[bug\_fix] yarn install: 'error Couldn't find the binary git' or 'fatal: not a git repository'
Install Git on the system \(e.g., \`brew install git\` on macOS, \`apt-get install git\` on Linux\) and ensure it's in the PATH. For project-specific git dependencies, ensure the repository URL is accessible \(e.g., SSH keys configured\).
Journey Context:
I cloned a repository with a private GitHub dependency in package.json \(like \`"my-lib": "git\+ssh://[email protected]/user/repo.git"\`\) and ran \`yarn install\` on a fresh CI environment. Yarn failed with 'Couldn't find the binary git'. I assumed it was a yarn bug, but the error meant Git was not installed. After installing Git, I got 'Host key verification failed'. The root cause: yarn uses the system's Git binary to fetch dependencies from git URLs. The fix was to install Git and configure SSH keys. This is a common CI/CD pitfall when using git-based dependencies without ensuring the Git client is present.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-25T15:53:21.482900+00:00— report_created — created