1. 配置全局变量
$ git config --global user.name "Your name here"
$ git config --global user.email "your_email@example.com"
2. 在你的电脑上设置ssh
ssh-keygen -t rsa -C "your_email@example.com"
linux 下生成的public key应该存储在 /root/.ssh/id_rsa.pub。在终端下打印出公钥。
$ cat /root/.ssh/id_rsa.pub
将获得一串以ssh-rsa 开头的字符串,将其复制至剪贴板。
3. 设置github
打开github.com,登录你的个人账户。点击头像 >> settings >> SSH Keys >> new SSH key
title随便起,将剪贴板中的公钥粘贴至Key的输入框中,点击Add SSH key即可。