使用 git客戶端在本機生成ssh祕鑰

一、使用 git 客戶端生成公私鑰:id_rsa、id_rsa.pub

1、設置Git的user name和email

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

2、檢查是不是已經存在密鑰(能進去說明已經存在,就刪掉文件夾,重新創建)

cd ~/.ssh

3、生成 SSH 密鑰,打開命令行終端輸入ssh-keygen -t rsa -C “[email protected]”( 你的郵箱),連續點擊 Enter 鍵即可。

C:\Users\xxx>ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\xxx/.ssh/id_rsa):// 推薦使用默認地址
Created directory 'C:\Users\xxx/.ssh'.
Enter passphrase (empty for no passphrase)://此處點擊 Enter 鍵即可,也可以填寫密碼,填寫密碼後每次使用 SSH 方式推送代碼時都會要求輸入密碼,由於這個 Key 只用於本機提交代碼,所以也無需設置密碼。
Enter same passphrase again:

在這裏插入圖片描述
在這裏插入圖片描述

問題解決~

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