ls -al ~/.ssh
ssh-keygen -t rsa -C "347969164@qq.com"
操作
Enter file in which to save the key (/home/qy/.ssh/id_rsa): #【按回車】
Enter passphrase (empty for no passphrase): #【輸入密碼】
密碼 ****
Enter same passphrase again: # 【再次輸入密碼】
密碼 ****
金鑰檔案目錄
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:joUMKG8+3KkO8dbpRyvHYgOG8ufydZNL3jkMYYB6mO8 347969164@qq.com
The key's randomart image is:
+---[RSA 2048]----+
| . |
| .. . |
|. .+. . |
| o+ .o .o |
|..oo o.S. |
|o*oo.o.+.. |
|oo*o=oo.*o |
| oo+E.=+ +o. |
| .o*+* o o. |
+----[SHA256]-----+
eval $(ssh-agent -s)
輸出
Agent pid 22939
ssh-add ~/.ssh/id_rsa
gitee 的
ssh -T git@gitee.com
github的
ssh -T git@github.com
操作流程
# The authenticity of host 'gitee.com (180.97.125.228)' can't be established.
# ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
# ECDSA key fingerprint is MD5:27:e5:d3:f7:2a:9e:eb:6c:93:cd:1f:c1:47:a3:54:b1.
# Are you sure you want to continue connecting (yes/no)? yes
# 輸入 yes
# Warning: Permanently added 'gitee.com,180.97.125.228' (ECDSA) to the list of known hosts.
# Enter passphrase for key '/root/.ssh/id_rsa':
# 輸入公鑰密碼
# Hi 簡簡單單OnlineZuozuo! You've successfully authenticated, but GITEE.COM does not provide shell access.
# 成功