github 创建密匙怎么设置密码
发布网友
发布时间:2022-04-28 21:09
我来回答
共1个回答
热心网友
时间:2022-06-23 05:19
一、创建SSH KEY
1. 打开git bash
2. 输入
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
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 git@github.com
$ ssh -T git@github.com
Enter passphrase for key '/c/Users/flyer/.ssh/id_rsa':
Hi XX! You've successfully authenticated, but GitHub does not provide shell access.