1.ssh -v git@github.com
2. ssh-agent -s
3. ssh-add ~/.ssh/id_rsa
如果有报:Could not open a connection to your authentication agent.
3.1:eval `ssh-agent -s`
在执行 3.2 :ssh-add ~/.ssh/id_rsa
4.将客户端生成的key添加到github账户
首先使用 clip < ~/.ssh/id_rsa.pub 或者文本编辑拷贝id_rsa.pub文本内容
到github右上角账户管理-Setting下面找到左侧“SSH and GPG keys”菜单,接着点击“Add SSH key”,在"title"栏输入一个自己喜欢的标题,“key”栏中粘贴刚刚复制的公钥内容,最后点击“Add key”按钮。
5.最后一步,验证key
- $ ssh -T git@github.com
- Hi JsonJu! You've successfully authenticated, but GitHub does not provide shell access.