GitHub入门(二)-本地连接GitHub

1.使用GitHub前的准备

1.1创建GitHub账号创建账号

1.2设置SSH Key

1.2.1生成密钥和公钥$ ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key
(/Users/your_user_directory/.ssh/id_rsa):
按回车键
Enter passphrase (empty for no passphrase): 输入密码

Enter same passphrase again: 再次输入密码


id_rsa 文件是私有密钥, id_rsa.pub 是公开密钥

1.2.2查看公钥cat ~/.ssh/id_rsa.pub

1.2.3将公钥中的内容复制到GitHub账户中的SSH中并添加,添加成功之后,创建账户时所用的邮箱会接到一封提示“公共密钥添加完成”的邮件。

1.3测试本地和GitHub的连接

$ ssh -T [email protected]
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is fingerprint
.

Are you sure you want to continue connecting (yes/no)? 输入yes

Enter passphrase for key '/c/Users/ThinkPad/.ssh/id_rsa':输入创建SSH时的密码

出现以下内容代表成功

Hi hirocastest! You've successfully authenticated, but GitHub does not

provide shell access.







猜你喜欢

转载自blog.csdn.net/ly853602/article/details/80378009