第一次在Mac连接GitHub
一、 安装好Git了之后,设置Git的连接:
第一次使用没有SSH目录,先创建一个新的SSH KEY ,打开Mac的终端输入:
$ ssh-keygen -t rsa -C "github账号的邮箱" 1.注意C是大写的 2.记得输入你的github账号的邮箱 ,回车3.会输出下面
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/susonglin/.ssh/id_rsa): //这里直接按enter(回车键)
二、按下enter(回车)之后会出现以下代码提示
Enter passphrase (empty for no passphrase):
//提示你输入密码(不管直接按回车,不输入则是空的啦)
Enter same passphrase again:
//提示你重新输入以便确认输入是否正确(还是不管直接回车)
随后会提示一大串我看不懂的,反正大概意思就是你创建好了 id_rsa 和 id_rsa.pub 文件。
接下来就要找** id_rsa.pub**文件
$ open ~/.ssh
即可,打开文件夹(弹出来),就可以找到id_rsa.pub文件了。
然后用Sublime编译器打开(为在 Github 上添加你的 SSH KEY 做铺垫) ,如下图

按下回车键

三、在 Github 上添加你的 SSH KEY
1.登陆github,点Your


3.点击SSH and GPG keys

4.点SSH kys 右边的New SSH key(创建SSH

5.好了之后会出现这样如图下

四、验证你的Github连接
在终端输入
$ ssh -T git@github.com
出现以下代码
The authenticity of host 'github.com (192.30.255.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
输入yes后,会显示出以下代码(表示成功了)
Hi xxxx! You've successfully authenticated, but GitHub does not provide shell access.