1. SSH配置

请参考使用SSH博客

配置config文件

vim ~/.ssh/config

在里面添加

Host github.com
  HostName github.com
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/xxx
  # 这里xxx换成你命名的私钥名称

2. 添加SSH key到GitHub

拷贝xxx.pub文件的内容

vim ~/.ssh/xxx.pub

登录GitHub账号,从右上角的设置进入,然后点击菜单栏的 SSH key 进入页面添加 SSH key

3. 设置Git信息

git config --global user.name '你的名字' 
git config --global user.email '你的邮箱'

git config --list可以查看信息