git生成密鑰公鑰

GIT填寫名字和郵箱

git config --global user.name "name"
$ git config --global user.email "[email protected]"

查看填寫的郵箱和名字

git config –list 

查看自己是否已生成公鑰密鑰
在這裏插入圖片描述
沒有就

ssh-keygen -t rsa -C  "[email protected]"

點擊三次回車鍵

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 [email protected](上面自己的郵箱)
The key's randomart image is:
+---[RSA 2048]----+
|    +E .         |
| ..+oo+          |
| oo+*+.o         |
|o.*===+o         |
|==+*... S        |
|B.+.o .o         |
|++o. +  .        |
| +o.+ .          |
|.  o.o           |
+----[SHA256]-----+

最後在.ssh目錄下得到了兩個文件:id_rsa(私有祕鑰)和id_rsa.pub(公有密鑰)

如果想登陸遠端,則需要將rsa.pub裏的祕鑰添加到遠端。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章