1. 程式人生 > >生成git公鑰私鑰

生成git公鑰私鑰

cd ~/.ssh

如果能進入到.ssh檔案目錄下 ,則證明,之前生成過.ssh祕鑰,可以直接使用裡面的祕鑰。
如果不能進入到.ssh檔案目錄下,則:
檢測下自己之前有沒有配置:git config user.name和git config user.email(直接分別輸入這兩個命令)

一、如果之前沒有配置過
1.配置

 git config --global user.name 'llh'
 git config --global user.email '[email protected]'

2.生成祕鑰

ssh-keygen -t rsa -C ‘上面的郵箱’
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/llh/.ssh/id_rsa):(位置)
Enter passphrase (empty for no passphrase):(私鑰密碼)
Enter same passphrase again:(確認密碼)

3,然後本地電腦C盤使用者目錄下的.ssh資料夾下,發現已經生成了2個檔案
id_rsa私鑰
id_rsa.pub公鑰