前置#
终端 git、ssh-keygen 命令正常使用
检查系统内是否已经有 ssh 密钥#
Linux、MacOS 终端执行:
ls ~/.ssh
git 全局配置#
git config --global user.name 你的用户名
粟子:git config --global user.name zhiao
git config --global user.email 你的邮箱
粟子:git config --global user.email [email protected]
生成秘钥#
ssh-keygen -t rsa -C '你上面git配置的邮箱'
粟子:ssh-keygen -t rsa -C '[email protected]'
将公钥粘贴进 Github#
github-> 右上角头像 ->setting->SSH and GPG keys->New SSH key
- 起个 Title
- 终端进入~/.ssh 目录,将.pub 结尾的文件内容粘贴到 Key 中
- Add SSH key