一、如果之前沒有配置過
1.配置
git config –global user.name ‘xxxxx’
git config –global user.email ‘xxx@xx.xxx’
2.生成秘鑰
ssh-keygen -t rsa -C ‘上面的郵箱’
接著按3個(gè)回車 則:
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Mr.Yang/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Mr.Yang/.ssh/id_rsa.
Your public key has been saved in /c/Users/Mr.Yang/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:zA6wNJrFB6NcqS6eBog/AHlzQuvFjYpG759Yhh1lWGI xxxxxx@xxxxx.xxx(上面自己的郵箱)
The key's randomart image is:
+---[RSA 2048]----+
| +E . |
| ..+oo+ |
| oo+*+.o |
|o.*===+o |
|==+*... S |
|B.+.o .o |
|++o. + . |
| +o.+ . |
|. o.o |
+----[SHA256]-----+
最后在.ssh目錄下得到了兩個(gè)文件:id_rsa(私有秘鑰)和id_rsa.pub(公有密鑰)
如果想登陸遠(yuǎn)端贴谎,則需要將rsa.pub里的秘鑰添加到遠(yuǎn)端蛆挫。