遇到Command failed with exit code 128: git ls-remote [email protected]:xxx/xxx问题的解决方案
记录开发过程中遇到的问题
1. 遇到的问题
在安装依赖的时候npm install xxx 的时候控制台报错,类似于这样的
Command failed with exit code 128: git ls-remote [email protected]:xqq/webworkify-webpack.git HEAD fatal: unable to access 'https://github.com/xqq/webworkify-webpack.git/': Recv failure: Connection was reset 2. 解决方案:
- 访问https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent这个地址
- 打开
Git Bash(就是从git拉取代码控制台),按照步骤生成一个SSH key
- 主要是这个命令,邮箱替换成你的github账号邮箱
ssh-keygen -t ed25519 -C "[email protected]" - 他会生成一个公钥文件,默认应该在
C:\Users\Administrator\.ssh这个文件夹下面,具体的可以在生成过程中看到 - 访问https://github.com/settings/keys这个地址(需要先登录github)点击
New SSH keys这个按钮进入到添加ssh配置的页面 Title自己可以自定义,Key type使用默认的Authentication Key- 下面的输入框需要使用之前生成文件夹中的后缀名称为
.pub里面内容,建议使用开发的编辑器打开,打开之后的内容为ssh + 你之前输入的邮箱,只需要复制前面的就可以 - 确定之后,在重新
npm install xxx就可以正常下载依赖了