1. 程式人生 > >Mac系統 Git遠端克隆倉庫出現Permission denied (publickey)

Mac系統 Git遠端克隆倉庫出現Permission denied (publickey)

由於電腦重灌再次會想起首次配置git遠端克隆倉庫的bug,出現以下bug

The authenticity of host 'gitee.com (手動打碼)' can't be established.
ECDSA key fingerprint is 手動打碼.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'gitee.com,手動打碼' (ECDSA) to the list of known hosts.
Bad packet length 393759手動打碼.
ssh_dispatch_run_fatal: Connection to 手動打碼 port 22: Connection corrupted
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

原因是沒有將MAC本地公鑰配置到git上,解決方法: 1.生成SSH Key(已經有公鑰的直接跳到第二步) 開啟終端輸入ssh-keygen -t rsa -C "此引號內填寫郵箱地址"

2.開啟訪達前往.ssh目錄,找到生成Key值的目錄,這個目錄下會生成三個檔案:id_rsa(私鑰),id_rsa.pub(公鑰),known_hosts。 在這裡插入圖片描述 在這裡插入圖片描述

3.用文字編輯開啟id_rsa.pub檔案,複製檔案全部內容 在這裡插入圖片描述

4.登陸碼雲https://gitee.com/,按一下步驟操作,把剛複製的公鑰黏貼到相應位置,操作完成後就可正常克隆了,親測有效~!

在這裡插入圖片描述