1. 设置Git的name和email
git config --global user.name "name"
git config --global user.email "email"
2. 生成密钥
ssh-keygen -t rsa -b 4096 -C "email"
3. 将密钥添加到ssh-agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
4. 登陆github,添加SSH
将id_rsa.pub文件的内容添加到github
cd ~/.ssh/id_rsa.pub
clip < ~/.ssh/id_rsa.pub
5. 测试
ssh -T git@github.com
本文转自点击打开链接