pnpm: Host key verification failed

pnpm version:

8.6.7

Code to reproduce the issue:

pnpm add jsdoc@3.2.0

Actual behavior:

pnpm: Command failed with exit code 128: git -c core.longpaths=true fetch --depth 1 origin 95c5d505 Host key verification failed. fatal: Could not read from remote repository.

Additional information:

ERROR  Command failed with exit code 128: git -c core.longpaths=true fetch --depth 1 origin 95c5d505 Host key verification failed. fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

pnpm: Command failed with exit code 128: git -c core.longpaths=true fetch --depth 1 origin 95c5d505 Host key verification failed. fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. at makeError (E:\prog\npm\node_modules\pnpm\dist\pnpm.cjs:24796:17) at handlePromise (E:\prog\npm\node_modules\pnpm\dist\pnpm.cjs:25367:33) at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async gitFetcher (E:\prog\npm\node_modules\pnpm\dist\pnpm.cjs:113063:11) at async fetcher (E:\prog\npm\node_modules\pnpm\dist\pnpm.cjs:125600:16) at async run (E:\prog\npm\node_modules\pnpm\dist\pnpm.cjs:124984:23) Progress: resolved 8, reused 0, downloaded 8, added 0

  • node -v prints:v16.18.1
  • Windows, macOS, or Linux?:windows – Microsoft Windows [版本 10.0.14393]

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 17 (8 by maintainers)

Commits related to this issue

Most upvoted comments

https://github.com/pnpm/pnpm/issues/7517 I am also confused. This problem still exists in 9.6.0

Not sure why this is closed, the issue is still present (tested on pnpm v9.5.0). pnpm will always use ssh even if the package.json/pnpm-lock.yaml uses an https url

Current workaround if installing in a container is to force git to clone via https for the specific packages you need, e.g.:

git config --global url."https://github.com/username/repository.git".insteadOf git@github.com:username/repository.git

@KSXGitHub I don’t use ssh on public repo. In package.json i have https, but pnpm try git ls-remote with git+ssh.

@KSXGitHub @zkochan Can anyone review this? This seems not correctly fixed.

Private keys are not supposed to exist on GitHub Workflows, so the following errors are throw when pnpm force using ssh to clone:

ERROR  Command failed with exit code 128: /usr/bin/git clone git@github.com:xqq/webworkify-webpack.git /home/runner/setup-pnpm/node_modules/.bin/store/v3/tmp/_tmp_1806_d61cc271c1b5b05961f35800d24acb7c
Cloning into '/home/runner/setup-pnpm/node_modules/.bin/store/v3/tmp/_tmp_1806_d61cc271c1b5b05961f35800d24acb7c'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

pnpm: Command failed with exit code 128: /usr/bin/git clone git@github.com:xqq/webworkify-webpack.git /home/runner/setup-pnpm/node_modules/.bin/store/v3/tmp/_tmp_1806_d61cc271c1b5b05961f35800d24acb7c
Cloning into '/home/runner/setup-pnpm/node_modules/.bin/store/v3/tmp/_tmp_1806_d61cc271c1b5b05961f35800d24acb7c'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
    at makeError (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.15.1/node_modules/pnpm/dist/pnpm.cjs:17863:17)
    at handlePromise (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.15.1/node_modules/pnpm/dist/pnpm.cjs:18434:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async execGit (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.15.1/node_modules/pnpm/dist/pnpm.cjs:114189:7)
    at async gitFetcher (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.15.1/node_modules/pnpm/dist/pnpm.cjs:114144:11)
    at async fetcher (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.15.1/node_modules/pnpm/dist/pnpm.cjs:133706:[16](https://github.com/vuepress-theme-hope/vuepress-theme-hope/actions/runs/12532941022/job/34952136592#step:5:17))
    at async run (/home/runner/setup-pnpm/node_modules/.pnpm/pnpm@9.15.1/node_modules/pnpm/dist/pnpm.cjs:133156:23)
Error: Process completed with exit code 1.

image 8.6.x has no problem, 8.7.x will encounter the problem in the screenshot above

I can’t install repo https://github.com/signal-ai/angular-sha1.git

ERROR  Command failed with exit code 128: git ls-remote git+ssh://git@github.com/SignalMedia/angular-sha1.git HEAD git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

With https protocol command git ls-remote working, with git+ssh not.

Pnpm Version 7.33.4 is ok, but 7.33.6 or 8.7.1 have this error…