首先需要安裝好git,註冊好github賬號
- 生成公鑰
在任意處,git bash,輸入以下命令
ssh-keygen -t rsa -b 4096 -C "註冊github的郵箱"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):“輸入保存密鑰的文件的文件名,可直接回車”
Enter passphrase (empty for no passphrase):“可直接回車”
Enter same passphrase again:“可直接回車”
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
SHA256:NCYQZN5+D4HI9ZhuILjwiSJVo4t4ZEIjVZUznjWqbQE
。。。。。
。。。。
還會得到兩個文件,在git bash打開的文件夾中
- 複製公鑰
在剛剛的git bash中
$ clip < ~/.ssh/id_rsa.pub
- 設置sshkey
打開自己的github主頁
點擊最右上角的頭像下的settings,找到SSH and GPR keys
title的值自定義即可
key的值填入,直接粘貼即可,我們已經使用clip命令複製了
這就完成了
綁定之後,就可以直接通過ssh地址來clone項目了