當我們使用github等倉庫時,我們有需要ssh認證,所以需要生成它的ssh key。
1、首先你要安裝git工具
下載地址:https://git-scm.com/downloads
注冊github地址:https://github.com/
2、右鍵鼠標,選中 “Git Bash here”
3、輸入指令,進入.ssh文件夾
cd ~/.ssh/
如果提示 “ No such file or directory”,你可以手動的創建一個 .ssh文件夾即可
mkdir ~/.ssh
4、生成key
cd ~/.ssh/
ssh-keygen -t rsa -C "xxxyyyzzz@qq.com"
連續按三次回車,這里設置的密碼就為空了,並且創建了key。
最后得到了兩個文件:id_rsa和id_rsa.pub
5、用記事本打開id_rsa.pub,復制里面的內容添加到你github或者bitbucket ssh設置里即可
6、測試是否添加成功
github輸入命令:ssh git@github.com
提示:“Hi lsyz0021! You've successfully authenticated, but GitHub does not provide shel l access.”說明添加成功。
參考資料: