配置 GitHub 通过 SSH 秘钥连接
1. 生成key
2. 添加秘钥到 ssh-agent
如果自定义了秘钥文件名,就需要把秘钥添加到 ssh-agent
中。
1 | ssh-add ~/.ssh/github_auth |
这一步也可以通过 ssh config 文件来显式设置域名用指定的秘钥
1 | vim ~/.ssh/config |
3. 添加秘钥到 GitHub 账户
个人中心 Settings -> SSH and GPG keys -> New SSH Key
把 ~/.ssh/github_auth.pub
内容粘贴到 Key 输入框。
4. 验证
用一下命令验证是否配置成功。
注:
安装好 git
后,需要先设置全局用户名和邮箱才能使用。
配置 GitHub 通过 SSH 秘钥连接
来做第一个留言的人吧!