Report #58563
[bug\_fix] npm ERR\! code 128 npm ERR\! An unknown git error occurred npm ERR\! command git --no-replace-objects ls-remote ssh://[email protected]/user/repo.git
Ensure SSH keys are configured for GitHub/GitLab, OR switch git URLs to HTTPS by running \`git config --global url."https://github.com/".insteadOf "ssh://[email protected]/"\` or setting environment variable \`GIT\_SSH\_COMMAND\`. On Windows, ensure Pageant or Windows OpenSSH agent is running with your key. Root cause: npm is spawning git to fetch a dependency via SSH but git cannot authenticate \(no key, wrong permissions, or firewall blocking port 22\) or cannot find the git executable.
Journey Context:
You clone a private repo or install a package with git\+ssh dependencies on a fresh CI runner or Windows laptop. \`npm install\` fails with 'code 128'. The error mentions 'git ls-remote ssh://[email protected]/...'. You try running the git command manually and get 'Permission denied \(publickey\)'. You realize npm is trying to fetch a private repo or a fork via SSH but the environment has no SSH key loaded. On your local machine, you start ssh-agent and add your key, or on CI you configure a deploy key. Alternatively, you globally configure git to rewrite SSH URLs to HTTPS so npm uses https:// instead of ssh://, bypassing SSH key requirements but requiring token-based auth instead. After fixing git auth, \`npm install\` succeeds because git can now fetch the remote repository.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T04:47:14.420379+00:00— report_created — created