1.查看是否已经生成过 SSH Key
ls ~/.ssh
2.生成 SSH Key
ssh-keygen -t rsa -C "**********@foxmail.com"
3.将私钥添加到 ssh-agent
输入以下命令打开 ssh-agent :
eval "$(ssh-agent -s)"
输入以下命令将私钥添加到 ssh-agent:
ssh-add ~/.ssh/id_rsa
4.将公钥添加到远程仓库
不同的 Git 远程仓库都可以添加同一个 SSH Key
5.Copy
pbcopy < ~/.ssh/id_rsa.pub