Mac SourceTree配置SSH

作者: 大斌小姜 | 来源:发表于2018-10-24 19:35 被阅读3次

生成SSH

  1. 创建SSH,执行ssh-keygen -t rsa -C "youremail@example.com",会在.ssh目录下生成id_rsaid_rsa.pub两个私钥和公钥。
  2. 通过cat ~/.ssh/id_rsa.pub查看公钥,并将公钥整体复制,配置到GitHub等后台。
$ cat ~/.ssh/id_rsa.pub
ssh-rsa xxxxxxxxxxxxxxxxxxxxx youremail@example.com

配置本地SSH

  1. 执行ssh-add ~/.ssh/jiang_rsa将sshkey添加到sourceTree
  2. 执行ssh-add -K ~/.ssh/jiang_rsa将sshkey添加到钥匙串
  3. cd 到 .ssh目录下, 用touch config命令创建config文件
  4. 执行open config, 打开config文件,输入以下内容并保存
Host *
   UseKeychain yes
   AddKeysToAgent yes
   IdentityFile ~/.ssh/jiang_rsa

相关文章

网友评论

    本文标题:Mac SourceTree配置SSH

    本文链接:https://www.haomeiwen.com/subject/ifnxtqtx.html