1.配置本地git

  $git config --global user.name "xxx"

  $git config --global user.email "xxxxxx@xxx"

 

2.生成密钥

  $ssh-keygen -t rsa -C "xxxxxxx@xxx"

  生成过程中需要创建密码,可以回车省略。

 

3.在github添加密钥

  打开生成的id_rsa.pub,复制粘贴到github的Personal settings页面,SSH keys.

 

4.github连通性测试

  $ssh git@github.com

  出现xxx! You've successfully authenticated....

 

至此,git成功连接到自己的github仓库.