# Git身份配置

## 配置个人身份

> 告诉git你是谁，只需要配置一次即可

- 配置邮箱

<CodePreview title="user" language="bash" executable={false} code={'git config --global user.email "you@example.com"'} />

- 配置用户名

<CodePreview title="user" language="bash" executable={false} code={'git config --global user.name "Your Name"'} />

## 配置Key

> 配置SSH Key，在Git远程仓库配置后即可免密拉取

- 先看看是否已有密钥

<CodePreview title="user" language="bash" code={'cat ~/.ssh/id_rsa.pub'} />

- 没有的话就生成一个

<CodePreview title="user" language="bash" executable={false} code={'ssh-keygen -t rsa -C "备注，建议可以标识你的设备"'} />

- 查看公钥，复制到粘贴板备用

<CodePreview title="user" language="bash" code={'cat ~/.ssh/id_rsa.pub'} />