windows 下 npm 拉取 github 仓库问题

npm拉私有仓库报错:git@github.com: Permission denied (publickey) 怎么办呢?

npm 拉私有仓库报错无权限问题

$ npm i https://github.com/littlewrite/frameless-titlebar@v2.1.4-reatv18
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/littlewrite/frameless-titlebar@v2.1.4-reatv18.git
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\wojia\AppData\Local\npm-cache\_logs\2022-07-27T03_44_39_166Z-debug-0.log

解决否

已解决

解决方案

  1. 在本地 生成 ssh key,然后添加到 github 配置。
  2. 添加到本地项目
  3. windows 下要启动一个啥 服务
  4. 可以开始 npm install 了, 带上https:// 后缀 .git ,如果要制定tag 再添加 #V1.0.0

参考

  • https://docs.github.com/cn/authentication/troubleshooting-ssh/error-permission-denied-publickey
  • https://www.zhihu.com/question/21402411
  • https://stackoverflow.com/questions/17846529/could-not-open-a-connection-to-your-authentication-agent
  • https://github.com/npm/npm/issues/14447