MacOS下Github添加ssh key的步骤

打开终端
输入:
ssh-keygen -t rsa -C "[email protected]"

回车,出现如下提示:

Last login: Tue Oct 31 10:20:24 on ttys004
bogon:~ YYKit$ ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/xx/.ssh/id_rsa): 

继续回车,中间会让输入两次密码,什么都不输入,继续回车,会出现如下内容:

Last login: Tue Oct 31 10:20:24 on ttys004
bogon:~ YYKit$ ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/xx/.ssh/id_rsa): 
/Users/xx/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/xx/.ssh/id_rsa.
Your public key has been saved in /Users/xx/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:rp+6MLo27uTIONMqlO6/E9d9CvJzvVt5QI9I6Z2vy14 [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|                 |
|            .    |
|           o .   |
|          o + +  |
|  .   . S  o = . |
| o . o + . .  +  |
|o.. = o o +  o E |
|*=+o o + + .o +  |
|*XB=o ++=  o+=.  |
+----[SHA256]-----+
bogon:~ YYKit$ 

这时候,复制/Users/xxx/.ssh/id_rsa.pub.,然后前往文件夹,

MacOS下Github添加ssh key的步骤_第1张图片
屏幕快照 2017-10-31 上午10.33.30.png

打开id_rsa.pub,复制"[email protected]"之前的部分。

这时候,来到Github,在你的个人账户中,按照顺序依次点击“Settings --> SSH and GPG keys --> SSH keys --> New SSH Key”,Title可以写自己喜欢的标记,在Key下面粘贴之前复制的内容,然后点击Add SSH Key,之后可能会让你输入账户密码进行验证,这就就添加成功了。

你可能感兴趣的:(MacOS下Github添加ssh key的步骤)