Gitee 怎樣生成公鑰?


ssh-keygen 不是內部或外部命令解決辦法!

Microsoft Windows [版本 6.1.7601]
版權所有 (c) 2009 Microsoft Corporation。保留所有權利。

C:\Users\dphudy>ssh-keygen -t rsa -C "2921832035@qq.com"
'ssh-keygen' 不是內部或外部命令,也不是可運行的程序
或批處理文件。

解決辦法一、設置環境變量

參考:https://www.cnblogs.com/e0yu/p/8508009.html
Git安裝路徑 D:\Program Files\Git\usr\bin
設置完成
結果:重新執行失敗,可能需要重啟變量才會生效或者路徑設置錯誤。

解決辦法二、ssh.exe 根目錄下執行命令

C:\Users\dphudy> cd D:\Program Files\Git\usr\bin

C:\Users\dphudy>D:

D:\Program Files\Git\usr\bin>ssh-keygen -t rsa -C "2921832035@qq.com";
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/dphudy/.ssh/id_rsa):

生成/添加SSH公鑰

按照提示完成三次回車,即可生成 ssh key。

D:\Program Files\Git\usr\bin>ssh-keygen -t rsa -C "2921832035@qq.com";
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/dphudy/.ssh/id_rsa):
Created directory '/c/Users/dphudy/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/dphudy/.ssh/id_rsa
Your public key has been saved in /c/Users/dphudy/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:Mcook4KNWm5Sge+PUQuVv4q0bR7bvZwlwBCLEFBJHhE 2921832035@qq.com;
The key's randomart image is:
+---[RSA 3072]----+
|=+E+.            |
| +.o +           |
|. + =   o        |
|.+ + * . o       |
|+ X o * S        |
|.* = . o         |
|o * o . . .      |
| + B.= o +       |
|  +o* . =.       |
+----[SHA256]-----+

使用文本編輯器打開將KEY添加

添加后,在終端(Terminal)中輸入 ssh -T git@gitee.com

dphudy@dp071708004 MINGW64 ~
$ ssh -T git@gitee.com
The authenticity of host 'gitee.com (180.97.125.228)' can't be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitee.com,180.97.125.228' (ECDSA) to the list of known hosts.
Hi 小岳! You've successfully authenticated, but GITEE.COM does not provide shell access.

首次使用需要確認並添加主機到本機SSH可信列表。若返回 Hi XXX! You've successfully authenticated, but Gitee.com does not provide shell access. 內容,則證明添加成功。
參考幫助中心:https://gitee.com/help/articles/4181#article-header0


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM