github 创建密匙怎么设置密码

如题所述

一、创建SSH KEY
1. 打开git bash
2. 输入
$ ssh-keygen -t rsa -b 4096 -C "[email protected]"
3. 默认路径即可,回车
$ Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
4. 创建密码,并重复输入
$ Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same

$ passphrase again: [Type passphrase again]
二、将SSH key添加到 ssh-agent

1. 测试ssh-agent是否能用
eval "$(ssh-agent -s)"
Agent pid 59566
2. 将SSH key添加到 ssh-agent
$ ssh-add ~/.ssh/id_rsa
3. 将SSH key添加到 GIThub https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
1)settings
2)SSH and GPG keys.
3)点击 New SSH key.
4)title随便取个名字
5)将C:\Users\xx\.ssh下面的 id_rsa.pub 文件的内容粘贴过来

三、测试是否能用
打开Git Bash,输入 ssh -T [email protected]

$ ssh -T [email protected]
Enter passphrase for key '/c/Users/flyer/.ssh/id_rsa':
Hi XX! You've successfully authenticated, but GitHub does not provide shell access.
温馨提示:答案为网友推荐,仅供参考
相似回答