报错:git@192.168.48.48: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)


通过git clone完项目然后进行npm install 报错

1 npm ERR! git@192.168.48.48: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
2 npm ERR! fatal: Could not read from remote repository.
3 npm ERR!
4 npm ERR! Please make sure you have the correct access rights
5 npm ERR! and the repository exists.

原因:缺少SSH密钥

解决方法:

  • 打开项目里面.git文件夹(为隐藏文件夹)
  • 打开config文件,将项目的SSH地址复制到相应位置(注意!url里的 ssh:// 不要写)
  • 设置git的user name和email
  • 1 $ git config --global user.name "test" 
    2 $ git config --global user.email "test@gmail.com"

     

  • 打开git bash here,输入
    1 ssh-keygen -t rsa -C “test@gmail.com”

    然后一直点回车

  • 在远程仓库上添加ssh密钥,添加的是“id_rsa.pub”(在用户文件下的.ssh文件夹内)里面的公钥

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM