设置Git连接到Github

121 阅读1分钟

准备工作

在本地安装Git,并在Github注册账号。

设置Git

打开Git Bash,输入命令:

git config --global user.name "your_username"
git config --global user.email ""

创建SSH Key:

ssh-keygen -t rsa

之后会生成两个文件:id_rsaid_rsa.pub,打开id_rsa.pub并复制其中内容。

在Github上添加SSH key

进入github.com/settings/ke… ,选择 SSH and GPG keys

image.png

选择右上角 New SSH key

image.png

Title中给你的设备起一个名字(也可以不填),然后把id_rsa.pub的内容复制添加到key中。

image.png