- 添加账户:

- 连接账号

3.创建密钥
执行ssh-add ~/.ssh/id_rsa 将sshkey添加到sourceTree
执行ssh-add -K ~/.ssh/id_rsa 将sshkey添加到钥匙串
id_rsa 修改成您密钥的名称
- 配置密钥
cd 到 .ssh目录下, 用touch config命令创建config文件
执行open config, 打开config文件.
# --- Sourcetree Generated ---
Host xxxxxxxx-GitHub
HostName github.com
User xxxxxx
PreferredAuthentications publickey
IdentityFile /Users/xxxxx/.ssh/id_rsa
UseKeychain yes
AddKeysToAgent yes
# ----------------------------
输入上面的配置内容, 保存·config文件
以后每次启动电脑source tree都会自动加载sshkey.
- 公钥信任
执行ssh git@github.com 命令链接一下git服务器,进行公钥信任

网友评论