问题描述
在执行 npm install 安装依赖时,控制台报错如下:
Command failed with exit code 128: git ls-remote ...
解决方案
- 访问官方文档生成 SSH Key。
- 打开 Git Bash,运行以下命令(替换邮箱):
ssh-keygen -t ed25519 -C "[email protected]"
- 公钥文件默认位于
C:\Users\Administrator\.ssh。 - 登录 GitHub,进入 Settings > SSH and GPG keys,点击 New SSH keys。
- 自定义 Title,Key type 选 Authentication Key。
- 复制
.pub文件内容粘贴到 Key 框中。 - 保存后重新执行 npm install 即可。


