GitHub配置SSH
打开命令行,在命令行中输入:
git config --global user.name "你的名字"
git config --global user.email "你的邮箱"
然后输入生成ssh key的命令:
ssh-keygen -t rsa -C "你的邮箱"
之后一路回车,可以看到如下内容:
C:\Users\admin>git config --global user.name "tongjiebin"
C:\Users\admin>git config --global user.email "tongjiebin@163.com"
C:\Users\admin>ssh-keygen -t rsa -C "tongjiebin@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\admin/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\admin/.ssh/id_rsa.
Your public key has been saved in C:\Users\admin/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:wjIQre3rA6cSgCFGVsFmEVQmrKOZIH6+PGUwxF9P5Ms tongjiebin@163.com
The key's randomart image is:
+---[RSA 2048]----+
|.oBO=o .. |
|+. O+ ... |
|+.*o. . o. |
|=o.+.o ... |
|*o..= o SE |
|=...o= . |
| .o+o. |
|. ooo |
| . ++. |
+----[SHA256]-----+
C:\Users\admin>
如果看到了上面的内容,就表示ssh key
生成成功了,存储在C:\Users\admin\.ssh\id_rsa.pub
目录下。
登录GitHub
,点击右上角的头像=>点击Settings
=>点击SSH and GPG keys
=>点击New SSH key
,出现如下界面:
在Title
中随意输入一个标题,在Key
中复制粘贴id_rsa.pub
文件里的所有内容,点击Add SSH key
会提示你输入GitHub
的密码,输入密码后点击提交就大功告成了。
现在就可以愉快地使用git clone
克隆GitHub
上面的代码啦。