報錯: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