git 的入门使用

下载安装 git

git 下载地址:https://git-scm.com/downloads

配置用户名

1
git config --global user.name "Your Name"

设置邮箱

1
git config --global user.email "your_email@example.com"

列出当前用户的全局 Git 配置信息

1
git config --global --list

user.email=your_email@example.com
user.name=Your Name

连接 GitHub

创建 SSH 密钥

1
ssh-keygen -t rsa -C "your_email@example.com"

id_rsa 私钥保存在本地
id_rsa.pub 公钥复制到远程

查看公钥

1
cat ~/.ssh/id_rsa.pub

ssh-rsa ** your_email@example.com

复制公钥到 GitHub

测试 SSH 是否连接到 GitHub

1
ssh -T git@github.com

Hi Your Name! You’ve successfully authenticated, but GitHub does not provide shell access.